wifi(interface): Use the "bitfield" type for masks
Change all the variables representing masks to the new bitfield type
in all the Wifi HIDL interfaces.
The generated code will still produce the underlying type of enum as
param. So, no changes are needed in the implementation.
Bug: 33358724
Test: Compiles
Change-Id: Id2e5dee2ce1f1ec8e744aa1c81d3cb9c66e7fc39
diff --git a/wifi/1.0/IWifiChip.hal b/wifi/1.0/IWifiChip.hal
index d790404..b0598a4 100644
--- a/wifi/1.0/IWifiChip.hal
+++ b/wifi/1.0/IWifiChip.hal
@@ -205,7 +205,8 @@
* |WifiStatusCode.ERROR_UNKNOWN|
* @return capabilities Bitset of |ChipCapabilityMask| values.
*/
- getCapabilities() generates (WifiStatus status, uint32_t capabilities);
+ getCapabilities()
+ generates (WifiStatus status, bitfield<ChipCapabilityMask> capabilities);
/**
* Get the set of operation modes that the chip supports.
diff --git a/wifi/1.0/IWifiStaIface.hal b/wifi/1.0/IWifiStaIface.hal
index 7dad8af..6a738a9 100644
--- a/wifi/1.0/IWifiStaIface.hal
+++ b/wifi/1.0/IWifiStaIface.hal
@@ -120,7 +120,9 @@
* |WifiStatusCode.ERROR_UNKNOWN|
* @return capabilities Bitset of |StaIfaceCapabilityMask| values.
*/
- getCapabilities() generates (WifiStatus status, uint32_t capabilities);
+ getCapabilities()
+ generates (WifiStatus status,
+ bitfield<StaIfaceCapabilityMask> capabilities);
/**
* Used to query additional information about the chip's APF capabilities.
diff --git a/wifi/1.0/types.hal b/wifi/1.0/types.hal
index 1e86be4..edf306d 100644
--- a/wifi/1.0/types.hal
+++ b/wifi/1.0/types.hal
@@ -254,7 +254,7 @@
* Bands that can be specified in Background scan requests.
*/
enum StaBackgroundScanBand : uint32_t {
- BAND_UNSPECIFIED,
+ BAND_UNSPECIFIED = 0,
/**
* 2.4 GHz.
*/
@@ -325,10 +325,10 @@
*/
uint32_t periodInMs;
/**
- * Bitset of |BackgroundScanBucketEventReportSchemeMask| values controlling
+ * Bitset of |StaBackgroundScanBucketEventReportSchemeMask| values controlling
* when events for this bucket must be reported.
*/
- uint32_t eventReportScheme;
+ bitfield<StaBackgroundScanBucketEventReportSchemeMask> eventReportScheme;
/**
* For exponential back off. If |exponentialMaxPeriodInMs| is non zero or
* different than period, then this bucket is an exponential backoff bucket
@@ -503,7 +503,7 @@
/**
* Bitset containing |ScanDataFlagMask| values.
*/
- uint32_t flags;
+ bitfield<StaScanDataFlagMask> flags;
/**
* Bitset where each bit indicates if the bucket with that index was
* scanned.
@@ -843,6 +843,23 @@
};
/**
+ * Cipher suite flags - to be used as a bitmask.
+ */
+enum NanCipherSuiteType : uint32_t {
+ SHARED_KEY_128_MASK = 1 << 0,
+ SHARED_KEY_256_MASK = 1 << 1
+};
+
+/**
+ * Ranging in the context of discovery sessions indication controls - to be used as a bitmask.
+ */
+enum NanRangingIndication : uint32_t {
+ CONTINUOUS_INDICATION_MASK = 1 << 0,
+ INGRESS_MET_MASK = 1 << 1,
+ EGRESS_MET_MASK = 1 << 2
+};
+
+/**
* Configurations of NAN discovery sessions: common to publish and subscribe discovery.
*/
struct NanDiscoveryCommonConfig {
@@ -921,7 +938,7 @@
* Cipher types supported in data-paths constructed in the context of this discovery session. The
* |NanCipherSuiteType| bit fields are used to set this value.
*/
- uint32_t supportedCipherTypes;
+ bitfield<NanCipherSuiteType> supportedCipherTypes;
/**
* Optional PMK for data-paths constructed in the context of this discovery session. A PMK could
* also be provided during the actual construction of the data-path (which allows unique PMKs for
@@ -949,7 +966,7 @@
* The type of ranging indication feedback to be provided by discovery session matches. Use
* bit-fields from |NanRangingIndication|.
*/
- uint32_t configRangingIndications;
+ bitfield<NanRangingIndication> configRangingIndications;
/**
* The ingress and egress distance in cm. If ranging is eanbled (|rangingEnabled| is true) then
* \configRangingIndications\ is used to determine whether ingress and/or egress (or neither)
@@ -960,23 +977,6 @@
};
/**
- * Cipher suite flags - to be used as a bitmask.
- */
-enum NanCipherSuiteType : uint32_t {
- SHARED_KEY_128_MASK = 1 << 0,
- SHARED_KEY_256_MASK = 1 << 1
-};
-
-/**
- * Ranging in the context of discovery sessions indication controls - to be used as a bitmask.
- */
-enum NanRangingIndication : uint32_t {
- CONTINUOUS_INDICATION_MASK = 1 << 0,
- INGRESS_MET_MASK = 1 << 1,
- EGRESS_MET_MASK = 1 << 2
-};
-
-/**
* Publish request: specifies a publish discovery operation.
*/
struct NanPublishRequest {
@@ -1111,7 +1111,7 @@
* Cipher types supported in data-paths constructed in the context of this discovery session. The
* |NanCipherSuiteType| bit fields are used to set this value.
*/
- uint32_t supportedCipherTypes;
+ bitfield<NanCipherSuiteType> supportedCipherTypes;
/**
* PMK of the data-path being requested (if |securityRequired| is true).
* Max length: 32
@@ -1150,7 +1150,7 @@
* Cipher types supported in data-paths constructed in the context of this discovery session. The
* |NanCipherSuiteType| bit fields are used to set this value.
*/
- uint32_t supportedCipherTypes;
+ bitfield<NanCipherSuiteType> supportedCipherTypes;
/**
* PMK of the data-path being requested (if |securityRequired| is true).
* Max length: 32
@@ -1243,7 +1243,7 @@
/**
* The set of supported Cipher suites. The |NanCipherSuiteType| bit fields are used.
*/
- uint32_t supportedCipherSuites;
+ bitfield<NanCipherSuiteType> supportedCipherSuites;
};
/**
@@ -1294,7 +1294,7 @@
* Cipher types supported by the peer for data-paths constructed in the context of this discovery
* session. The |NanCipherSuiteType| bit fields are used to set this value.
*/
- uint32_t peerSupportedCipherTypes;
+ bitfield<NanCipherSuiteType> peerSupportedCipherTypes;
/**
* Indicates whether or not the peer requires security enabled in any data-path (NDP) constructed
* in the context of this discovery session.
@@ -1327,7 +1327,7 @@
* The ranging event(s) which triggered the ranging. Uses bit-fields from |NanRangingIndication|.
* E.g. can indicate that continuous ranging is required, or else that an ingress event occurred.
*/
- uint32_t rangingIndicationType;
+ bitfield<NanRangingIndication> rangingIndicationType;
};
/**
@@ -1421,7 +1421,7 @@
* Frames on which this vendor specific attribute was received.
* Mask |NanVsaRxFrameMask| defined above.
*/
- uint8_t vsaReceivedOnFrames;
+ bitfield<NanVsaRxFrameMask> vsaReceivedOnFrames;
/**
* Organizationally Unique Identifier (OUI) of the vendor-specific attribute.
*/
@@ -1811,12 +1811,12 @@
* Bit mask indicates what preamble is supported by initiator.
* Combination of |RttPreamble| values.
*/
- uint8_t preambleSupport;
+ bitfield<RttPreamble> preambleSupport;
/**
* Bit mask indicates what BW is supported by initiator.
* Combination of |RttBw| values.
*/
- uint8_t bwSupport;
+ bitfield<RttBw> bwSupport;
/**
* Draft 11mc spec version supported by chip.
* For instance, version 4.0 must be 40 and version 4.3 must be 43 etc.
diff --git a/wifi/supplicant/1.0/ISupplicantP2pIface.hal b/wifi/supplicant/1.0/ISupplicantP2pIface.hal
index ed0b49f..45e90f3 100644
--- a/wifi/supplicant/1.0/ISupplicantP2pIface.hal
+++ b/wifi/supplicant/1.0/ISupplicantP2pIface.hal
@@ -410,10 +410,11 @@
* |SupplicantStatusCode.SUCCESS|,
* |SupplicantStatusCode.FAILURE_UNKNOWN|,
* |SupplicantStatusCode.FAILURE_IFACE_INVALID|
- * @return capabilityMask Combination of |GroupCapabilityMask| values.
+ * @return capabilityMask Combination of |P2pGroupCapabilityMask| values.
*/
getGroupCapability(MacAddress peerAddress)
- generates (SupplicantStatus status, uint32_t capabilities);
+ generates (SupplicantStatus status,
+ bitfield<P2pGroupCapabilityMask> capabilities);
/**
* This command can be used to add a bonjour service.
diff --git a/wifi/supplicant/1.0/ISupplicantStaNetwork.hal b/wifi/supplicant/1.0/ISupplicantStaNetwork.hal
index 7d86f42..b347c1d 100644
--- a/wifi/supplicant/1.0/ISupplicantStaNetwork.hal
+++ b/wifi/supplicant/1.0/ISupplicantStaNetwork.hal
@@ -197,7 +197,7 @@
* |SupplicantStatusCode.FAILURE_UNKNOWN|,
* |SupplicantStatusCode.FAILURE_NETWORK_INVALID|
*/
- setKeyMgmt(uint32_t keyMgmtMask) generates (SupplicantStatus status);
+ setKeyMgmt(bitfield<KeyMgmtMask> keyMgmtMask) generates (SupplicantStatus status);
/**
* Set proto mask for the network.
@@ -211,7 +211,7 @@
* |SupplicantStatusCode.FAILURE_UNKNOWN|,
* |SupplicantStatusCode.FAILURE_NETWORK_INVALID|
*/
- setProto(uint32_t protoMask) generates (SupplicantStatus status);
+ setProto(bitfield<ProtoMask> protoMask) generates (SupplicantStatus status);
/**
* Set auth alg mask for the network.
@@ -225,7 +225,7 @@
* |SupplicantStatusCode.FAILURE_UNKNOWN|,
* |SupplicantStatusCode.FAILURE_NETWORK_INVALID|
*/
- setAuthAlg(uint32_t authAlgMask) generates (SupplicantStatus status);
+ setAuthAlg(bitfield<AuthAlgMask> authAlgMask) generates (SupplicantStatus status);
/**
* Set group cipher mask for the network.
@@ -239,7 +239,7 @@
* |SupplicantStatusCode.FAILURE_UNKNOWN|,
* |SupplicantStatusCode.FAILURE_NETWORK_INVALID|
*/
- setGroupCipher(uint32_t groupCipherMask)
+ setGroupCipher(bitfield<GroupCipherMask> groupCipherMask)
generates (SupplicantStatus status);
/**
@@ -254,7 +254,7 @@
* |SupplicantStatusCode.FAILURE_UNKNOWN|,
* |SupplicantStatusCode.FAILURE_NETWORK_INVALID|
*/
- setPairwiseCipher(uint32_t pairwiseCipherMask)
+ setPairwiseCipher(bitfield<PairwiseCipherMask> pairwiseCipherMask)
generates (SupplicantStatus status);
/**
@@ -568,7 +568,7 @@
* @return keyMgmtMask Combination of |KeyMgmtMask| values.
*/
getKeyMgmt()
- generates (SupplicantStatus status, uint32_t keyMgmtMask);
+ generates (SupplicantStatus status, bitfield<KeyMgmtMask> keyMgmtMask);
/**
* Get the proto mask set for the network.
@@ -579,7 +579,7 @@
* |SupplicantStatusCode.FAILURE_NETWORK_INVALID|
* @return protoMask Combination of |ProtoMask| values.
*/
- getProto() generates (SupplicantStatus status, uint32_t protoMask);
+ getProto() generates (SupplicantStatus status, bitfield<ProtoMask> protoMask);
/**
* Get the auth alg mask set for the network.
@@ -591,7 +591,7 @@
* @return authAlgMask Combination of |AuthAlgMask| values.
*/
getAuthAlg()
- generates (SupplicantStatus status, uint32_t authAlgMask);
+ generates (SupplicantStatus status, bitfield<AuthAlgMask> authAlgMask);
/**
* Get the group cipher mask set for the network.
@@ -603,7 +603,8 @@
* @return groupCipherMask Combination of |GroupCipherMask| values.
*/
getGroupCipher()
- generates (SupplicantStatus status, uint32_t groupCipherMask);
+ generates (SupplicantStatus status,
+ bitfield<GroupCipherMask> groupCipherMask);
/**
* Get the pairwise cipher mask set for the network.
@@ -615,7 +616,8 @@
* @return pairwiseCipherMask Combination of |PairwiseCipherMask| values.
*/
getPairwiseCipher()
- generates (SupplicantStatus status, uint32_t pairwiseCipherMask);
+ generates (SupplicantStatus status,
+ bitfield<PairwiseCipherMask> pairwiseCipherMask);
/**
* Get passphrase for WPA_PSK network.