From 09f2ce3b3e26504e15615b202a6722cee2c35f58 Mon Sep 17 00:00:00 2001 From: Roshan Pius Date: Wed, 11 Jan 2017 14:05:17 -0800 Subject: [PATCH] supplicant(interface): Add P2P iface methods/cbs Add the missing P2P iface methods and callbacks. Bug: 34221586 Test: Compiles Change-Id: I9bace8ac5304dd65d81bb255dac023657c9460cc --- wifi/supplicant/1.0/Android.mk | 38 +++ wifi/supplicant/1.0/ISupplicantP2pIface.hal | 51 ++-- .../1.0/ISupplicantP2pIfaceCallback.hal | 252 ++++++++++++++++++ wifi/supplicant/1.0/ISupplicantP2pNetwork.hal | 58 ++++ wifi/supplicant/1.0/types.hal | 10 + 5 files changed, 394 insertions(+), 15 deletions(-) diff --git a/wifi/supplicant/1.0/Android.mk b/wifi/supplicant/1.0/Android.mk index 02a62b65e2..937691dd1a 100644 --- a/wifi/supplicant/1.0/Android.mk +++ b/wifi/supplicant/1.0/Android.mk @@ -35,6 +35,25 @@ $(GEN): $(LOCAL_PATH)/types.hal $(transform-generated-source) LOCAL_GENERATED_SOURCES += $(GEN) +# +# Build types.hal (P2pGroupCapabilityMask) +# +GEN := $(intermediates)/android/hardware/wifi/supplicant/V1_0/P2pGroupCapabilityMask.java +$(GEN): $(HIDL) +$(GEN): PRIVATE_HIDL := $(HIDL) +$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal +$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates) +$(GEN): PRIVATE_CUSTOM_TOOL = \ + $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \ + -Ljava \ + -randroid.hardware:hardware/interfaces \ + -randroid.hidl:system/libhidl/transport \ + android.hardware.wifi.supplicant@1.0::types.P2pGroupCapabilityMask + +$(GEN): $(LOCAL_PATH)/types.hal + $(transform-generated-source) +LOCAL_GENERATED_SOURCES += $(GEN) + # # Build types.hal (SupplicantStatus) # @@ -376,6 +395,25 @@ $(GEN): $(LOCAL_PATH)/types.hal $(transform-generated-source) LOCAL_GENERATED_SOURCES += $(GEN) +# +# Build types.hal (P2pGroupCapabilityMask) +# +GEN := $(intermediates)/android/hardware/wifi/supplicant/V1_0/P2pGroupCapabilityMask.java +$(GEN): $(HIDL) +$(GEN): PRIVATE_HIDL := $(HIDL) +$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal +$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates) +$(GEN): PRIVATE_CUSTOM_TOOL = \ + $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \ + -Ljava \ + -randroid.hardware:hardware/interfaces \ + -randroid.hidl:system/libhidl/transport \ + android.hardware.wifi.supplicant@1.0::types.P2pGroupCapabilityMask + +$(GEN): $(LOCAL_PATH)/types.hal + $(transform-generated-source) +LOCAL_GENERATED_SOURCES += $(GEN) + # # Build types.hal (SupplicantStatus) # diff --git a/wifi/supplicant/1.0/ISupplicantP2pIface.hal b/wifi/supplicant/1.0/ISupplicantP2pIface.hal index ddf05cca51..ed0b49faa6 100644 --- a/wifi/supplicant/1.0/ISupplicantP2pIface.hal +++ b/wifi/supplicant/1.0/ISupplicantP2pIface.hal @@ -40,16 +40,6 @@ interface ISupplicantP2pIface extends ISupplicantIface { KEYPAD }; - enum GroupCapabilityMask : uint32_t { - GROUP_OWNER = 1 << 0, - PERSISTENT_GROUP = 1 << 1, - GROUP_LIMIT = 1 << 2, - INTRA_BSS_DIST = 1 << 3, - CROSS_CONN = 1 << 4, - PERSISTENT_RECONN = 1 << 5, - GROUP_FORMATION = 1 << 6 - }; - /** * Use to specify a range of frequencies. * For example: 2412-2432,2462,5000-6000, etc. @@ -533,7 +523,8 @@ interface ISupplicantP2pIface extends ISupplicantIface { * @return status Status of the operation. * Possible status codes: * |SupplicantStatusCode.SUCCESS|, - * |SupplicantStatusCode.FAILURE_UNKNOWN| + * |SupplicantStatusCode.FAILURE_UNKNOWN|, + * |SupplicantStatusCode.FAILURE_IFACE_INVALID| */ setMiracastMode(MiracastMode mode) generates (SupplicantStatus status); @@ -548,7 +539,8 @@ interface ISupplicantP2pIface extends ISupplicantIface { * @return status Status of the operation. * Possible status codes: * |SupplicantStatusCode.SUCCESS|, - * |SupplicantStatusCode.FAILURE_UNKNOWN| + * |SupplicantStatusCode.FAILURE_UNKNOWN|, + * |SupplicantStatusCode.FAILURE_IFACE_INVALID| */ startWpsPbc(string groupIfName, Bssid bssid) generates (SupplicantStatus status); @@ -561,7 +553,8 @@ interface ISupplicantP2pIface extends ISupplicantIface { * @return status Status of the operation. * Possible status codes: * |SupplicantStatusCode.SUCCESS|, - * |SupplicantStatusCode.FAILURE_UNKNOWN| + * |SupplicantStatusCode.FAILURE_UNKNOWN|, + * |SupplicantStatusCode.FAILURE_IFACE_INVALID| */ startWpsPinKeypad(string groupIfName, string pin) generates (SupplicantStatus status); @@ -574,7 +567,8 @@ interface ISupplicantP2pIface extends ISupplicantIface { * @return status Status of the operation. * Possible status codes: * |SupplicantStatusCode.SUCCESS|, - * |SupplicantStatusCode.FAILURE_UNKNOWN| + * |SupplicantStatusCode.FAILURE_UNKNOWN|, + * |SupplicantStatusCode.FAILURE_IFACE_INVALID| * @return generatedPin 8 digit pin generated. */ startWpsPinDisplay(string groupIfName, Bssid bssid) @@ -587,7 +581,34 @@ interface ISupplicantP2pIface extends ISupplicantIface { * @return status Status of the operation. * Possible status codes: * |SupplicantStatusCode.SUCCESS|, - * |SupplicantStatusCode.FAILURE_UNKNOWN| + * |SupplicantStatusCode.FAILURE_UNKNOWN|, + * |SupplicantStatusCode.FAILURE_IFACE_INVALID| + */ cancelWps(string groupIfName) generates (SupplicantStatus status); + + /** + * Enable/Disable Wifi Display. + * + * @param enable true to enable, false to disable. + * @return status Status of the operation. + * Possible status codes: + * |SupplicantStatusCode.SUCCESS|, + * |SupplicantStatusCode.FAILURE_UNKNOWN|, + * |SupplicantStatusCode.FAILURE_IFACE_INVALID| + */ + enableWfd(bool enable) generates (SupplicantStatus status); + + /** + * Set Wifi Display device info. + * + * @param info WFD device info as described in section 5.1.2 of WFD technical + * specification v1.0.0. + * @return status Status of the operation. + * Possible status codes: + * |SupplicantStatusCode.SUCCESS|, + * |SupplicantStatusCode.FAILURE_UNKNOWN|, + * |SupplicantStatusCode.FAILURE_IFACE_INVALID| + */ + setWfdDeviceInfo(uint8_t[8] info) generates (SupplicantStatus status); }; diff --git a/wifi/supplicant/1.0/ISupplicantP2pIfaceCallback.hal b/wifi/supplicant/1.0/ISupplicantP2pIfaceCallback.hal index 9ac8b364dc..0731209d67 100644 --- a/wifi/supplicant/1.0/ISupplicantP2pIfaceCallback.hal +++ b/wifi/supplicant/1.0/ISupplicantP2pIfaceCallback.hal @@ -25,6 +25,70 @@ package android.hardware.wifi.supplicant@1.0; * corresponding |ISupplicantP2pIface.registerCallback| method. */ interface ISupplicantP2pIfaceCallback { + /** + * WPS config methods. + */ + enum WpsConfigMethods : uint16_t { + USBA = 0x0001, + ETHERNET = 0x0002, + LABEL = 0x0004, + DISPLAY = 0x0008, + EXT_NFC_TOKEN = 0x0010, + INT_NFC_TOKEN = 0x0020, + NFC_INTERFACE = 0x0040, + PUSHBUTTON = 0x0080, + KEYPAD = 0x0100, + VIRT_PUSHBUTTON = 0x0280, + PHY_PUSHBUTTON = 0x0480, + P2PS = 0x1000, + VIRT_DISPLAY = 0x2008, + PHY_DISPLAY = 0x4008 + }; + + /** + * WPS Device Password ID + */ + enum WpsDevPasswordId : uint16_t { + DEFAULT = 0x0000, + USER_SPECIFIED = 0x0001, + MACHINE_SPECIFIED = 0x0002, + REKEY = 0x0003, + PUSHBUTTON = 0x0004, + REGISTRAR_SPECIFIED = 0x0005, + NFC_CONNECTION_HANDOVER = 0x0007, + P2PS_DEFAULT = 0x0008 + }; + + /** + * Status codes for P2P operations. + */ + enum P2pStatusCode : uint32_t { + SUCCESS = 0, + FAIL_INFO_CURRENTLY_UNAVAILABLE = 1, + FAIL_INCOMPATIBLE_PARAMS = 2, + FAIL_LIMIT_REACHED = 3, + FAIL_INVALID_PARAMS = 4, + FAIL_UNABLE_TO_ACCOMMODATE = 5, + FAIL_PREV_PROTOCOL_ERROR = 6, + FAIL_NO_COMMON_CHANNELS = 7, + FAIL_UNKNOWN_GROUP = 8, + FAIL_BOTH_GO_INTENT_15 = 9, + FAIL_INCOMPATIBLE_PROV_METHOD = 10, + FAIL_REJECTED_BY_USER = 11, + SUCCESS_DEFERRED = 12, + }; + + /** + * Status codes for P2P discovery. + */ + enum P2pProvDiscStatusCode : uint8_t { + SUCCESS = 0, + TIMEOUT = 1, + REJECTED = 2, + TIMEOUT_JOIN = 3, + INFO_UNAVAILABLE = 4 + }; + /** * Used to indicate that a new network has been added. * @@ -38,4 +102,192 @@ interface ISupplicantP2pIfaceCallback { * @param id Network ID allocated to the corresponding network. */ oneway onNetworkRemoved(SupplicantNetworkId id); + + /** + * Used to indicate that a P2P device has been found. + * + * @param srcAddress MAC address of the device found. This must either + * be the P2P device address or the P2P interface address. + * @param p2pDeviceAddress P2P device address. + * @param primaryDeviceType Type of device. Refer to section B.1 of Wifi P2P + * Technical specification v1.2. + * @param deviceName Name of the device. + * @param configMethods Mask of WPS configuration methods supported by the + * device. + * @param deviceCapabilities Refer to section 4.1.4 of Wifi P2P Technical + * specification v1.2. + * @param groupCapabilites Refer to section 4.1.4 of Wifi P2P Technical + * specification v1.2. + * @param wfdDeviceInfo WFD device info as described in section 5.1.2 of WFD + * technical specification v1.0.0. + */ + oneway onDeviceFound( + MacAddress srcAddress, MacAddress p2pDeviceAddress, + uint8_t[8] primaryDeviceType, string deviceName, + bitfield configMethods, uint8_t deviceCapabilities, + bitfield groupCapabilities, uint8_t[8] wfdDeviceInfo); + + /** + * Used to indicate that a P2P device has been lost. + * + * @param p2pDeviceAddress P2P device address. + */ + oneway onDeviceLost(MacAddress p2pDeviceAddress); + + /** + * Used to indicate the termination of P2P find operation. + */ + oneway onFindStopped(); + + /** + * Used to indicate the reception of a P2P Group Owner negotiation request. + * + * @param srcAddress MAC address of the device that initiated the GO + * negotiation request. + * @param passwordId Type of password. + */ + oneway onGoNegotiationRequest( + MacAddress srcAddress, WpsDevPasswordId passwordId); + + /** + * Used to indicate the completion of a P2P Group Owner negotiation request. + * + * @param status Status of the GO negotiation. + */ + oneway onGoNegotiationCompleted(P2pStatusCode status); + + /** + * Used to indicate a successful formation of a P2P group. + */ + oneway onGroupFormationSuccess(); + + /** + * Used to indicate a failure to form a P2P group. + * + * @param failureReason Failure reason string for debug purposes. + */ + oneway onGroupFormationFailure(string failureReason); + + /** + * Used to indicate the start of a P2P group. + * + * @param groupIfName Interface name of the group. (For ex: p2p-p2p0-1) + * @param isGo Whether this device is owner of the group. + * @param ssid SSID of the group. + * @param frequency Frequency on which this group is created. + * @param psk PSK used to secure the group. + * @param passphrase PSK passphrase used to secure the group. + * @param goDeviceAddress MAC Address of the owner of this group. + * @param isPersistent Whether this group is persisted or not. + */ + oneway onGroupStarted( + string groupIfname, bool isGo, Ssid ssid, uint32_t frequency, + uint8_t[32] psk, string passphrase, MacAddress goDeviceAddress, + bool isPersistent); + + /** + * Used to indicate the removal of a P2P group. + * + * @param groupIfName Interface name of the group. (For ex: p2p-p2p0-1) + * @param isGo Whether this device is owner of the group. + */ + oneway onGroupRemoved(string groupIfname, bool isGo); + + /** + * Used to indicate the reception of a P2P invitation. + * + * @param srcAddress MAC address of the device that sent the invitation. + * @param goDeviceAddress MAC Address of the owner of this group. + * @param Bssid Bssid of the group. + * @param persistentNetworkId Persistent network Id of the group. + * @param operatingFrequency Frequency on which the invitation was received. + */ + oneway onInvitationReceived( + MacAddress srcAddress, MacAddress goDeviceAddress, Bssid bssid, + SupplicantNetworkId persistentNetworkId, uint32_t operatingFrequency); + + /** + * Used to indicate the result of the P2P invitation request. + * + * @param Bssid Bssid of the group. + * @param status Status of the invitation. + */ + oneway onInvitationResult(Bssid bssid, P2pStatusCode status); + + /** + * Used to indicate a push-button request generated during provision discovery. + * + * @param p2pDeviceAddress P2P device address. + */ + oneway onProvisionDiscoveryPbcRequest(MacAddress p2pDeviceAddress); + + /** + * Used to indicate a push-button response generated during provision discovery. + * + * @param p2pDeviceAddress P2P device address. + */ + oneway onProvisionDiscoveryPbcResponse(MacAddress p2pDeviceAddress); + + /** + * Used to indicate the pin generated during provision discovery. + * + * @param p2pDeviceAddress P2P device address. + * @param generatedPin 8 digit pin generated. + */ + oneway onProvisionDiscoveryShowPin( + MacAddress p2pDeviceAddress, string generatedPin); + + /** + * Used to indicate that a pin needs to be entered during provision discovery. + * + * @param p2pDeviceAddress P2P device address. + */ + oneway onProvisionDiscoveryEnterPin(MacAddress p2pDeviceAddress); + + /** + * Used to indicate a provision discovery failure. + * + * @param p2pDeviceAddress P2P device address. + */ + oneway onProvisionDiscoveryFailure(MacAddress p2pDeviceAddress); + + /** + * Used to indicate the completion of a P2P provision discovery request. + * + * @param p2pDeviceAddress P2P device address. + * @param isRequest Whether we received or sent the provision discovery. + * @param status Status of the provision discovery. + * @param configMethods Mask of WPS configuration methods supported. + * @param generatedPin 8 digit pin generated. + */ + oneway onProvisionDiscoveryCompleted( + MacAddress p2pDeviceAddress, bool isRequest, P2pProvDiscStatusCode status, + bitfield configMethods, string generatedPin); + + /** + * Used to indicate the reception of a P2P service discovery response. + * + * @param srcAddress MAC address of the device that sent the service discovery. + * @param updateIndicator Service update indicator. Refer to section 3.1.3 of + * Wifi P2P Technical specification v1.2. + * @parm tlvs Refer to section 3.1.3.1 of Wifi P2P Technical specification v1.2. + */ + oneway onServiceDiscoveryResponse( + MacAddress srcAddress, uint16_t updateIndicator, vec tlvs); + + /** + * Used to indicate when a STA device is connected to this device. + * + * @param srcAddress MAC address of the device that was authorized. + * @param p2pDeviceAddress P2P device address. + */ + oneway onStaAuthorized(MacAddress srcAddress, MacAddress p2pDeviceAddress); + + /** + * Used to indicate when a STA device is disconnected from this device. + * + * @param srcAddress MAC address of the device that was deauthorized. + * @param p2pDeviceAddress P2P device address. + */ + oneway onStaDeauthorized(MacAddress srcAddress, MacAddress p2pDeviceAddress); }; diff --git a/wifi/supplicant/1.0/ISupplicantP2pNetwork.hal b/wifi/supplicant/1.0/ISupplicantP2pNetwork.hal index 34727c41e1..d32b47e85c 100644 --- a/wifi/supplicant/1.0/ISupplicantP2pNetwork.hal +++ b/wifi/supplicant/1.0/ISupplicantP2pNetwork.hal @@ -42,4 +42,62 @@ interface ISupplicantP2pNetwork extends ISupplicantNetwork { */ registerCallback(ISupplicantP2pNetworkCallback callback) generates (SupplicantStatus status); + + /** + * Getters for the various network params. + */ + /** + * Get SSID for this network. + * + * @return status Status of the operation. + * Possible status codes: + * |SupplicantStatusCode.SUCCESS|, + * |SupplicantStatusCode.FAILURE_NETWORK_INVALID| + * @return ssid value set. + */ + getSsid() generates (SupplicantStatus status, Ssid ssid); + + /** + * Get the BSSID set for this network. + * + * @return status Status of the operation. + * Possible status codes: + * |SupplicantStatusCode.SUCCESS|, + * |SupplicantStatusCode.FAILURE_NETWORK_INVALID| + * @return bssid value set. + */ + getBssid() generates (SupplicantStatus status, Bssid bssid); + + /** + * Check if the network is currently active one. + * + * @return status Status of the operation. + * Possible status codes: + * |SupplicantStatusCode.SUCCESS|, + * |SupplicantStatusCode.FAILURE_NETWORK_INVALID| + * @return isCurrent true if current, false otherwise. + */ + isCurrent() generates (SupplicantStatus status, bool isCurrent); + + /** + * Check if the network is marked persistent. + * + * @return status Status of the operation. + * Possible status codes: + * |SupplicantStatusCode.SUCCESS|, + * |SupplicantStatusCode.FAILURE_NETWORK_INVALID| + * @return isPersistent true if persistent, false otherwise. + */ + isPersistent() generates (SupplicantStatus status, bool isPersistent); + + /** + * Check if the device is the group owner of the network. + * + * @return status Status of the operation. + * Possible status codes: + * |SupplicantStatusCode.SUCCESS|, + * |SupplicantStatusCode.FAILURE_NETWORK_INVALID| + * @return isGo true if group owner, false otherwise. + */ + isGo() generates (SupplicantStatus status, bool isGo); }; diff --git a/wifi/supplicant/1.0/types.hal b/wifi/supplicant/1.0/types.hal index 16a8d15e7e..9889135a18 100644 --- a/wifi/supplicant/1.0/types.hal +++ b/wifi/supplicant/1.0/types.hal @@ -73,3 +73,13 @@ enum IfaceType : uint32_t { STA, P2P }; + +enum P2pGroupCapabilityMask : uint32_t { + GROUP_OWNER = 1 << 0, + PERSISTENT_GROUP = 1 << 1, + GROUP_LIMIT = 1 << 2, + INTRA_BSS_DIST = 1 << 3, + CROSS_CONN = 1 << 4, + PERSISTENT_RECONN = 1 << 5, + GROUP_FORMATION = 1 << 6 +};