Loading wifi/java/android/net/wifi/nan/ConfigRequest.java +65 −3 Original line number Diff line number Diff line Loading @@ -22,9 +22,10 @@ import android.os.Parcelable; /** * Defines a request object to configure a Wi-Fi NAN network. Built using * {@link ConfigRequest.Builder}. Configuration is requested using * {@link WifiNanManager#requestConfig(ConfigRequest)}. Note that the actual * achieved configuration may be different from the requested configuration - * since multiple applications may request different configurations. * {@link WifiNanManager#connect(android.os.Looper, WifiNanEventCallback, ConfigRequest)} * . Note that the actual achieved configuration may be different from the * requested configuration - since multiple applications may request different * configurations. * * @hide PROPOSED_NAN_API */ Loading Loading @@ -146,6 +147,30 @@ public class ConfigRequest implements Parcelable { && mEnableIdentityChangeCallback == lhs.mEnableIdentityChangeCallback; } /** * Checks for equality of two configuration - but only considering their * on-the-air NAN configuration impact. * * @param o Object to compare to. * @return true if configuration objects have the same on-the-air * configuration, false otherwise. * @hide */ public boolean equalsOnTheAir(Object o) { if (this == o) { return true; } if (!(o instanceof ConfigRequest)) { return false; } ConfigRequest lhs = (ConfigRequest) o; return mSupport5gBand == lhs.mSupport5gBand && mMasterPreference == lhs.mMasterPreference && mClusterLow == lhs.mClusterLow && mClusterHigh == lhs.mClusterHigh; } @Override public int hashCode() { int result = 17; Loading @@ -159,6 +184,39 @@ public class ConfigRequest implements Parcelable { return result; } /** * Validates that the contents of the ConfigRequest are valid. Otherwise * throws an IllegalArgumentException. * * @hide */ public void validate() throws IllegalArgumentException { if (mMasterPreference < 0) { throw new IllegalArgumentException( "Master Preference specification must be non-negative"); } if (mMasterPreference == 1 || mMasterPreference == 255 || mMasterPreference > 255) { throw new IllegalArgumentException("Master Preference specification must not " + "exceed 255 or use 1 or 255 (reserved values)"); } if (mClusterLow < CLUSTER_ID_MIN) { throw new IllegalArgumentException("Cluster specification must be non-negative"); } if (mClusterLow > CLUSTER_ID_MAX) { throw new IllegalArgumentException("Cluster specification must not exceed 0xFFFF"); } if (mClusterHigh < CLUSTER_ID_MIN) { throw new IllegalArgumentException("Cluster specification must be non-negative"); } if (mClusterHigh > CLUSTER_ID_MAX) { throw new IllegalArgumentException("Cluster specification must not exceed 0xFFFF"); } if (mClusterLow > mClusterHigh) { throw new IllegalArgumentException( "Invalid argument combination - must have Cluster Low <= Cluster High"); } } /** * Builder used to build {@link ConfigRequest} objects. */ Loading @@ -175,6 +233,7 @@ public class ConfigRequest implements Parcelable { * @param support5gBand Support for 5G band is required. * @return The builder to facilitate chaining * {@code builder.setXXX(..).setXXX(..)}. * @hide PROPOSED_NAN_SYSTEM_API */ public Builder setSupport5gBand(boolean support5gBand) { mSupport5gBand = support5gBand; Loading @@ -188,6 +247,7 @@ public class ConfigRequest implements Parcelable { * @param masterPreference The requested master preference * @return The builder to facilitate chaining * {@code builder.setXXX(..).setXXX(..)}. * @hide PROPOSED_NAN_SYSTEM_API */ public Builder setMasterPreference(int masterPreference) { if (masterPreference < 0) { Loading @@ -214,6 +274,7 @@ public class ConfigRequest implements Parcelable { * @param clusterLow The lower range of the generated cluster ID. * @return The builder to facilitate chaining * {@code builder.setClusterLow(..).setClusterHigh(..)}. * @hide PROPOSED_NAN_SYSTEM_API */ public Builder setClusterLow(int clusterLow) { if (clusterLow < CLUSTER_ID_MIN) { Loading @@ -238,6 +299,7 @@ public class ConfigRequest implements Parcelable { * @param clusterHigh The upper range of the generated cluster ID. * @return The builder to facilitate chaining * {@code builder.setClusterLow(..).setClusterHigh(..)}. * @hide PROPOSED_NAN_SYSTEM_API */ public Builder setClusterHigh(int clusterHigh) { if (clusterHigh < CLUSTER_ID_MIN) { Loading wifi/java/android/net/wifi/nan/IWifiNanEventCallback.aidl +2 −2 Original line number Diff line number Diff line Loading @@ -25,8 +25,8 @@ import android.net.wifi.nan.ConfigRequest; */ oneway interface IWifiNanEventCallback { void onConfigCompleted(in ConfigRequest completedConfig); void onConfigFailed(in ConfigRequest failedConfig, int reason); void onConnectSuccess(); void onConnectFail(int reason); void onNanDown(int reason); void onIdentityChanged(); } wifi/java/android/net/wifi/nan/IWifiNanManager.aidl +2 −2 Original line number Diff line number Diff line Loading @@ -32,9 +32,9 @@ import android.net.wifi.nan.SubscribeConfig; interface IWifiNanManager { // client API int connect(in IBinder binder, in IWifiNanEventCallback callback); int connect(in IBinder binder, in IWifiNanEventCallback callback, in ConfigRequest configRequest); void disconnect(int clientId, in IBinder binder); void requestConfig(int clientId, in ConfigRequest configRequest); void publish(int clientId, in PublishConfig publishConfig, in IWifiNanSessionCallback callback); void subscribe(int clientId, in SubscribeConfig subscribeConfig, Loading wifi/java/android/net/wifi/nan/IWifiNanSessionCallback.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ package android.net.wifi.nan; oneway interface IWifiNanSessionCallback { void onSessionStarted(int sessionId); void onSessionConfigSuccess(); void onSessionConfigFail(int reason); void onSessionTerminated(int reason); Loading wifi/java/android/net/wifi/nan/PublishConfig.java +44 −5 Original line number Diff line number Diff line Loading @@ -24,8 +24,8 @@ import java.util.Arrays; /** * Defines the configuration of a NAN publish session. Built using * {@link PublishConfig.Builder}. Publish is done using * {@link WifiNanManager#publish(PublishConfig, WifiNanSessionCallback, int)} or * {@link WifiNanPublishSession#publish(PublishConfig)}. * {@link WifiNanManager#publish(PublishConfig, WifiNanSessionCallback)} or * {@link WifiNanPublishSession#updatePublish(PublishConfig)}. * * @hide PROPOSED_NAN_API */ Loading Loading @@ -264,6 +264,45 @@ public class PublishConfig implements Parcelable { return result; } /** * Validates that the contents of the PublishConfig are valid. Otherwise * throws an IllegalArgumentException. * * @hide */ public void validate() throws IllegalArgumentException { if (mServiceSpecificInfoLength != 0 && (mServiceSpecificInfo == null || mServiceSpecificInfo.length < mServiceSpecificInfoLength)) { throw new IllegalArgumentException("Non-matching combination of " + "serviceSpecificInfo and serviceSpecificInfoLength"); } if (mTxFilterLength != 0 && (mTxFilter == null || mTxFilter.length < mTxFilterLength)) { throw new IllegalArgumentException( "Non-matching combination of txFilter and txFilterLength"); } if (mRxFilterLength != 0 && (mRxFilter == null || mRxFilter.length < mRxFilterLength)) { throw new IllegalArgumentException( "Non-matching combination of rxFilter and rxFilterLength"); } if (mPublishType < PUBLISH_TYPE_UNSOLICITED || mPublishType > PUBLISH_TYPE_SOLICITED) { throw new IllegalArgumentException("Invalid publishType - " + mPublishType); } if (mPublishCount < 0) { throw new IllegalArgumentException("Invalid publishCount - must be non-negative"); } if (mTtlSec < 0) { throw new IllegalArgumentException("Invalid ttlSec - must be non-negative"); } if (mPublishType == PublishConfig.PUBLISH_TYPE_UNSOLICITED && mRxFilterLength != 0) { throw new IllegalArgumentException("Invalid publish config: UNSOLICITED " + "publishes (active) can't have an Rx filter"); } if (mPublishType == PublishConfig.PUBLISH_TYPE_SOLICITED && mTxFilterLength != 0) { throw new IllegalArgumentException("Invalid publish config: SOLICITED " + "publishes (passive) can't have a Tx filter"); } } /** * Builder used to build {@link PublishConfig} objects. */ Loading Loading @@ -417,7 +456,7 @@ public class PublishConfig implements Parcelable { * Sets the number of times a solicited ( * {@link PublishConfig.Builder#setPublishType(int)}) publish session * will transmit a packet. When the count is reached an event will be * generated for {@link WifiNanSessionCallback#onPublishTerminated(int)} * generated for {@link WifiNanSessionCallback#onSessionTerminated(int)} * with reason={@link WifiNanSessionCallback#TERMINATE_REASON_DONE}. * * @param publishCount Number of publish packets to transmit. Loading @@ -437,7 +476,7 @@ public class PublishConfig implements Parcelable { * {@link PublishConfig.Builder#setPublishCount(int)}) publish session * will be alive - i.e. transmitting a packet. When the TTL is reached * an event will be generated for * {@link WifiNanSessionCallback#onPublishTerminated(int)} with reason= * {@link WifiNanSessionCallback#onSessionTerminated(int)} with reason= * {@link WifiNanSessionCallback#TERMINATE_REASON_DONE}. * * @param ttlSec Lifetime of a publish session in seconds. Loading @@ -454,7 +493,7 @@ public class PublishConfig implements Parcelable { /** * Configure whether a publish terminate notification * {@link WifiNanSessionCallback#onPublishTerminated(int)} is reported * {@link WifiNanSessionCallback#onSessionTerminated(int)} is reported * back to the callback. * * @param enable If true the terminate callback will be called when the Loading Loading
wifi/java/android/net/wifi/nan/ConfigRequest.java +65 −3 Original line number Diff line number Diff line Loading @@ -22,9 +22,10 @@ import android.os.Parcelable; /** * Defines a request object to configure a Wi-Fi NAN network. Built using * {@link ConfigRequest.Builder}. Configuration is requested using * {@link WifiNanManager#requestConfig(ConfigRequest)}. Note that the actual * achieved configuration may be different from the requested configuration - * since multiple applications may request different configurations. * {@link WifiNanManager#connect(android.os.Looper, WifiNanEventCallback, ConfigRequest)} * . Note that the actual achieved configuration may be different from the * requested configuration - since multiple applications may request different * configurations. * * @hide PROPOSED_NAN_API */ Loading Loading @@ -146,6 +147,30 @@ public class ConfigRequest implements Parcelable { && mEnableIdentityChangeCallback == lhs.mEnableIdentityChangeCallback; } /** * Checks for equality of two configuration - but only considering their * on-the-air NAN configuration impact. * * @param o Object to compare to. * @return true if configuration objects have the same on-the-air * configuration, false otherwise. * @hide */ public boolean equalsOnTheAir(Object o) { if (this == o) { return true; } if (!(o instanceof ConfigRequest)) { return false; } ConfigRequest lhs = (ConfigRequest) o; return mSupport5gBand == lhs.mSupport5gBand && mMasterPreference == lhs.mMasterPreference && mClusterLow == lhs.mClusterLow && mClusterHigh == lhs.mClusterHigh; } @Override public int hashCode() { int result = 17; Loading @@ -159,6 +184,39 @@ public class ConfigRequest implements Parcelable { return result; } /** * Validates that the contents of the ConfigRequest are valid. Otherwise * throws an IllegalArgumentException. * * @hide */ public void validate() throws IllegalArgumentException { if (mMasterPreference < 0) { throw new IllegalArgumentException( "Master Preference specification must be non-negative"); } if (mMasterPreference == 1 || mMasterPreference == 255 || mMasterPreference > 255) { throw new IllegalArgumentException("Master Preference specification must not " + "exceed 255 or use 1 or 255 (reserved values)"); } if (mClusterLow < CLUSTER_ID_MIN) { throw new IllegalArgumentException("Cluster specification must be non-negative"); } if (mClusterLow > CLUSTER_ID_MAX) { throw new IllegalArgumentException("Cluster specification must not exceed 0xFFFF"); } if (mClusterHigh < CLUSTER_ID_MIN) { throw new IllegalArgumentException("Cluster specification must be non-negative"); } if (mClusterHigh > CLUSTER_ID_MAX) { throw new IllegalArgumentException("Cluster specification must not exceed 0xFFFF"); } if (mClusterLow > mClusterHigh) { throw new IllegalArgumentException( "Invalid argument combination - must have Cluster Low <= Cluster High"); } } /** * Builder used to build {@link ConfigRequest} objects. */ Loading @@ -175,6 +233,7 @@ public class ConfigRequest implements Parcelable { * @param support5gBand Support for 5G band is required. * @return The builder to facilitate chaining * {@code builder.setXXX(..).setXXX(..)}. * @hide PROPOSED_NAN_SYSTEM_API */ public Builder setSupport5gBand(boolean support5gBand) { mSupport5gBand = support5gBand; Loading @@ -188,6 +247,7 @@ public class ConfigRequest implements Parcelable { * @param masterPreference The requested master preference * @return The builder to facilitate chaining * {@code builder.setXXX(..).setXXX(..)}. * @hide PROPOSED_NAN_SYSTEM_API */ public Builder setMasterPreference(int masterPreference) { if (masterPreference < 0) { Loading @@ -214,6 +274,7 @@ public class ConfigRequest implements Parcelable { * @param clusterLow The lower range of the generated cluster ID. * @return The builder to facilitate chaining * {@code builder.setClusterLow(..).setClusterHigh(..)}. * @hide PROPOSED_NAN_SYSTEM_API */ public Builder setClusterLow(int clusterLow) { if (clusterLow < CLUSTER_ID_MIN) { Loading @@ -238,6 +299,7 @@ public class ConfigRequest implements Parcelable { * @param clusterHigh The upper range of the generated cluster ID. * @return The builder to facilitate chaining * {@code builder.setClusterLow(..).setClusterHigh(..)}. * @hide PROPOSED_NAN_SYSTEM_API */ public Builder setClusterHigh(int clusterHigh) { if (clusterHigh < CLUSTER_ID_MIN) { Loading
wifi/java/android/net/wifi/nan/IWifiNanEventCallback.aidl +2 −2 Original line number Diff line number Diff line Loading @@ -25,8 +25,8 @@ import android.net.wifi.nan.ConfigRequest; */ oneway interface IWifiNanEventCallback { void onConfigCompleted(in ConfigRequest completedConfig); void onConfigFailed(in ConfigRequest failedConfig, int reason); void onConnectSuccess(); void onConnectFail(int reason); void onNanDown(int reason); void onIdentityChanged(); }
wifi/java/android/net/wifi/nan/IWifiNanManager.aidl +2 −2 Original line number Diff line number Diff line Loading @@ -32,9 +32,9 @@ import android.net.wifi.nan.SubscribeConfig; interface IWifiNanManager { // client API int connect(in IBinder binder, in IWifiNanEventCallback callback); int connect(in IBinder binder, in IWifiNanEventCallback callback, in ConfigRequest configRequest); void disconnect(int clientId, in IBinder binder); void requestConfig(int clientId, in ConfigRequest configRequest); void publish(int clientId, in PublishConfig publishConfig, in IWifiNanSessionCallback callback); void subscribe(int clientId, in SubscribeConfig subscribeConfig, Loading
wifi/java/android/net/wifi/nan/IWifiNanSessionCallback.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ package android.net.wifi.nan; oneway interface IWifiNanSessionCallback { void onSessionStarted(int sessionId); void onSessionConfigSuccess(); void onSessionConfigFail(int reason); void onSessionTerminated(int reason); Loading
wifi/java/android/net/wifi/nan/PublishConfig.java +44 −5 Original line number Diff line number Diff line Loading @@ -24,8 +24,8 @@ import java.util.Arrays; /** * Defines the configuration of a NAN publish session. Built using * {@link PublishConfig.Builder}. Publish is done using * {@link WifiNanManager#publish(PublishConfig, WifiNanSessionCallback, int)} or * {@link WifiNanPublishSession#publish(PublishConfig)}. * {@link WifiNanManager#publish(PublishConfig, WifiNanSessionCallback)} or * {@link WifiNanPublishSession#updatePublish(PublishConfig)}. * * @hide PROPOSED_NAN_API */ Loading Loading @@ -264,6 +264,45 @@ public class PublishConfig implements Parcelable { return result; } /** * Validates that the contents of the PublishConfig are valid. Otherwise * throws an IllegalArgumentException. * * @hide */ public void validate() throws IllegalArgumentException { if (mServiceSpecificInfoLength != 0 && (mServiceSpecificInfo == null || mServiceSpecificInfo.length < mServiceSpecificInfoLength)) { throw new IllegalArgumentException("Non-matching combination of " + "serviceSpecificInfo and serviceSpecificInfoLength"); } if (mTxFilterLength != 0 && (mTxFilter == null || mTxFilter.length < mTxFilterLength)) { throw new IllegalArgumentException( "Non-matching combination of txFilter and txFilterLength"); } if (mRxFilterLength != 0 && (mRxFilter == null || mRxFilter.length < mRxFilterLength)) { throw new IllegalArgumentException( "Non-matching combination of rxFilter and rxFilterLength"); } if (mPublishType < PUBLISH_TYPE_UNSOLICITED || mPublishType > PUBLISH_TYPE_SOLICITED) { throw new IllegalArgumentException("Invalid publishType - " + mPublishType); } if (mPublishCount < 0) { throw new IllegalArgumentException("Invalid publishCount - must be non-negative"); } if (mTtlSec < 0) { throw new IllegalArgumentException("Invalid ttlSec - must be non-negative"); } if (mPublishType == PublishConfig.PUBLISH_TYPE_UNSOLICITED && mRxFilterLength != 0) { throw new IllegalArgumentException("Invalid publish config: UNSOLICITED " + "publishes (active) can't have an Rx filter"); } if (mPublishType == PublishConfig.PUBLISH_TYPE_SOLICITED && mTxFilterLength != 0) { throw new IllegalArgumentException("Invalid publish config: SOLICITED " + "publishes (passive) can't have a Tx filter"); } } /** * Builder used to build {@link PublishConfig} objects. */ Loading Loading @@ -417,7 +456,7 @@ public class PublishConfig implements Parcelable { * Sets the number of times a solicited ( * {@link PublishConfig.Builder#setPublishType(int)}) publish session * will transmit a packet. When the count is reached an event will be * generated for {@link WifiNanSessionCallback#onPublishTerminated(int)} * generated for {@link WifiNanSessionCallback#onSessionTerminated(int)} * with reason={@link WifiNanSessionCallback#TERMINATE_REASON_DONE}. * * @param publishCount Number of publish packets to transmit. Loading @@ -437,7 +476,7 @@ public class PublishConfig implements Parcelable { * {@link PublishConfig.Builder#setPublishCount(int)}) publish session * will be alive - i.e. transmitting a packet. When the TTL is reached * an event will be generated for * {@link WifiNanSessionCallback#onPublishTerminated(int)} with reason= * {@link WifiNanSessionCallback#onSessionTerminated(int)} with reason= * {@link WifiNanSessionCallback#TERMINATE_REASON_DONE}. * * @param ttlSec Lifetime of a publish session in seconds. Loading @@ -454,7 +493,7 @@ public class PublishConfig implements Parcelable { /** * Configure whether a publish terminate notification * {@link WifiNanSessionCallback#onPublishTerminated(int)} is reported * {@link WifiNanSessionCallback#onSessionTerminated(int)} is reported * back to the callback. * * @param enable If true the terminate callback will be called when the Loading