Loading wifi/java/android/net/wifi/nan/ConfigRequest.java +1 −1 Original line number Diff line number Diff line Loading @@ -23,7 +23,7 @@ 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#connect(android.os.Handler, ConfigRequest, WifiNanEventCallback)}. * {@link WifiNanManager#attach(android.os.Handler, WifiNanEventCallback)}. * Note that the actual achieved configuration may be different from the * requested configuration - since different applications may request different * configurations. Loading wifi/java/android/net/wifi/nan/PublishConfig.java +3 −3 Original line number Diff line number Diff line Loading @@ -32,7 +32,7 @@ import java.util.Arrays; /** * Defines the configuration of a NAN publish session. Built using * {@link PublishConfig.Builder}. A publish session is created using * {@link WifiNanManager#publish(PublishConfig, WifiNanDiscoverySessionCallback)} or updated using * {@link WifiNanSession#publish(PublishConfig, WifiNanDiscoverySessionCallback)} or updated using * {@link WifiNanPublishDiscoverySession#updatePublish(PublishConfig)}. * * @hide PROPOSED_NAN_API Loading Loading @@ -323,7 +323,7 @@ public final class PublishConfig implements Parcelable { * {@link #setEnableTerminateNotification(boolean)} disables the callback]. * <p> * Optional. 0 by default - indicating the session doesn't terminate on its own. * Session will be terminated when {@link WifiNanDiscoveryBaseSession#terminate()} is * Session will be terminated when {@link WifiNanDiscoveryBaseSession#destroy()} is * called. * * @param publishCount Number of publish packets to broadcast. Loading @@ -349,7 +349,7 @@ public final class PublishConfig implements Parcelable { * {@link #setEnableTerminateNotification(boolean)} disables the callback]. * <p> * Optional. 0 by default - indicating the session doesn't terminate on its own. * Session will be terminated when {@link WifiNanDiscoveryBaseSession#terminate()} is * Session will be terminated when {@link WifiNanDiscoveryBaseSession#destroy()} is * called. * * @param ttlSec Lifetime of a publish session in seconds. Loading wifi/java/android/net/wifi/nan/SubscribeConfig.java +4 −4 Original line number Diff line number Diff line Loading @@ -32,7 +32,7 @@ import java.util.Arrays; /** * Defines the configuration of a NAN subscribe session. Built using * {@link SubscribeConfig.Builder}. Subscribe is done using * {@link WifiNanManager#subscribe(SubscribeConfig, WifiNanDiscoverySessionCallback)} or * {@link WifiNanSession#subscribe(SubscribeConfig, WifiNanDiscoverySessionCallback)} or * {@link WifiNanSubscribeDiscoverySession#updateSubscribe(SubscribeConfig)}. * * @hide PROPOSED_NAN_API Loading Loading @@ -354,7 +354,7 @@ public final class SubscribeConfig implements Parcelable { * with {@link WifiNanDiscoverySessionCallback#TERMINATE_REASON_DONE}. * <p> * Optional. 0 by default - indicating the session doesn't terminate on its own. * Session will be terminated when {@link WifiNanDiscoveryBaseSession#terminate()} is * Session will be terminated when {@link WifiNanDiscoveryBaseSession#destroy()} is * called. * * @param subscribeCount Number of subscribe packets to broadcast. Loading @@ -379,7 +379,7 @@ public final class SubscribeConfig implements Parcelable { * {@link WifiNanDiscoverySessionCallback#TERMINATE_REASON_DONE}. * <p> * Optional. 0 by default - indicating the session doesn't terminate on its own. * Session will be terminated when {@link WifiNanDiscoveryBaseSession#terminate()} is * Session will be terminated when {@link WifiNanDiscoveryBaseSession#destroy()} is * called. * * @param ttlSec Lifetime of a subscribe session in seconds. Loading @@ -399,7 +399,7 @@ public final class SubscribeConfig implements Parcelable { * Sets the match style of the subscription - how are matches from a * single match session (corresponding to the same publish action on the * peer) reported to the host (using the * {@link WifiNanDiscoverySessionCallback#onMatch(int, byte[], byte[])} * {@link WifiNanDiscoverySessionCallback#onServiceDiscovered(int, byte[], byte[])} * ). The options are: only report the first match and ignore the rest * {@link SubscribeConfig#MATCH_STYLE_FIRST_ONLY} or report every single * match {@link SubscribeConfig#MATCH_STYLE_ALL} (the default). Loading wifi/java/android/net/wifi/nan/WifiNanDiscoveryBaseSession.java +23 −20 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package android.net.wifi.nan; import android.annotation.Nullable; import android.annotation.SystemApi; import android.net.wifi.RttManager; import android.util.Log; Loading @@ -35,7 +36,7 @@ import java.lang.ref.WeakReference; * <li>Creating a network-specifier when requesting a NAN connection: * {@link #createNetworkSpecifier(int, int, byte[])}. * </ul> * The {@link #terminate()} method must be called to terminate discovery sessions once they are * The {@link #destroy()} method must be called to destroy discovery sessions once they are * no longer needed. * * @hide PROPOSED_NAN_API Loading Loading @@ -79,24 +80,24 @@ public class WifiNanDiscoveryBaseSession { mClientId = clientId; mSessionId = sessionId; mCloseGuard.open("terminate"); mCloseGuard.open("destroy"); } /** * Terminate the publish or subscribe session - free any resources, and stop * Destroy the publish or subscribe session - free any resources, and stop * transmitting packets on-air (for an active session) or listening for * matches (for a passive session). The session may not be used for any * additional operations after termination. * additional operations after its destruction. * <p> * This operation must be done on a session which is no longer needed. Otherwise system * resources will continue to be utilized until the application terminates. The only * resources will continue to be utilized until the application exits. The only * exception is a session for which we received a termination callback, * {@link WifiNanDiscoverySessionCallback#onSessionTerminated(int)}. */ public void terminate() { public void destroy() { WifiNanManager mgr = mMgr.get(); if (mgr == null) { Log.w(TAG, "terminate: called post GC on WifiNanManager"); Log.w(TAG, "destroy: called post GC on WifiNanManager"); return; } mgr.terminateSession(mClientId, mSessionId); Loading Loading @@ -127,7 +128,7 @@ public class WifiNanDiscoveryBaseSession { try { if (!mTerminated) { mCloseGuard.warnIfOpen(); terminate(); destroy(); } } finally { super.finalize(); Loading @@ -137,19 +138,20 @@ public class WifiNanDiscoveryBaseSession { /** * Sends a message to the specified destination. NAN messages are transmitted in the context * of a discovery session - executed subsequent to a publish/subscribe * {@link WifiNanDiscoverySessionCallback#onMatch(int, byte[], byte[])} event. * {@link WifiNanDiscoverySessionCallback#onServiceDiscovered(int, byte[], byte[])} event. * <p> * NAN messages are not guaranteed delivery. Callbacks on * {@link WifiNanDiscoverySessionCallback} indicate message was transmitted successfully, * {@link WifiNanDiscoverySessionCallback#onMessageSendSuccess(int)}, or transmission failed * {@link WifiNanDiscoverySessionCallback#onMessageSent(int)}, or transmission failed * (possibly after several retries) - * {@link WifiNanDiscoverySessionCallback#onMessageSendFail(int, int)}. * {@link WifiNanDiscoverySessionCallback#onMessageSendFailed(int, int)}. * <p> * The peer will get a callback indicating a message was received using * {@link WifiNanDiscoverySessionCallback#onMessageReceived(int, byte[])}. * * @param peerId The peer's ID for the message. Must be a result of an * {@link WifiNanDiscoverySessionCallback#onMatch(int, byte[], byte[])} or * {@link WifiNanDiscoverySessionCallback#onServiceDiscovered(int, byte[], byte[])} * or * {@link WifiNanDiscoverySessionCallback#onMessageReceived(int, byte[])} events. * @param message The message to be transmitted. * @param messageId An arbitrary integer used by the caller to identify the message. The same Loading Loading @@ -179,13 +181,13 @@ public class WifiNanDiscoveryBaseSession { /** * Sends a message to the specified destination. NAN messages are transmitted in the context * of a discovery session - executed subsequent to a publish/subscribe * {@link WifiNanDiscoverySessionCallback#onMatch(int, byte[], byte[])} event. * {@link WifiNanDiscoverySessionCallback#onServiceDiscovered(int, byte[], byte[])} event. * <p> * NAN messages are not guaranteed delivery. Callbacks on * {@link WifiNanDiscoverySessionCallback} indicate message was transmitted successfully, * {@link WifiNanDiscoverySessionCallback#onMessageSendSuccess(int)}, or transmission failed * {@link WifiNanDiscoverySessionCallback#onMessageSent(int)}, or transmission failed * (possibly after several retries) - * {@link WifiNanDiscoverySessionCallback#onMessageSendFail(int, int)}. * {@link WifiNanDiscoverySessionCallback#onMessageSendFailed(int, int)}. * <p> * The peer will get a callback indicating a message was received using * {@link WifiNanDiscoverySessionCallback#onMessageReceived(int, byte[])}. Loading @@ -193,7 +195,8 @@ public class WifiNanDiscoveryBaseSession { * 0. * * @param peerId The peer's ID for the message. Must be a result of an * {@link WifiNanDiscoverySessionCallback#onMatch(int, byte[], byte[])} or * {@link WifiNanDiscoverySessionCallback#onServiceDiscovered(int, byte[], byte[])} * or * {@link WifiNanDiscoverySessionCallback#onMessageReceived(int, byte[])} events. * @param message The message to be transmitted. * @param messageId An arbitrary integer used by the caller to identify the message. The same Loading @@ -207,7 +210,7 @@ public class WifiNanDiscoveryBaseSession { /** * Start a ranging operation with the specified peers. The peer IDs are obtained from an * {@link WifiNanDiscoverySessionCallback#onMatch(int, byte[], byte[])} or * {@link WifiNanDiscoverySessionCallback#onServiceDiscovered(int, byte[], byte[])} or * {@link WifiNanDiscoverySessionCallback#onMessageReceived(int, byte[])} operation - can only * range devices which are part of an ongoing discovery session. * Loading Loading @@ -250,7 +253,7 @@ public class WifiNanDiscoveryBaseSession { * {@link WifiNanManager#WIFI_NAN_DATA_PATH_ROLE_INITIATOR} or * {@link WifiNanManager#WIFI_NAN_DATA_PATH_ROLE_RESPONDER} * @param peerId The peer ID obtained through * {@link WifiNanDiscoverySessionCallback#onMatch(int, byte[], byte[])} or * {@link WifiNanDiscoverySessionCallback#onServiceDiscovered(int, byte[], byte[])} or * {@link WifiNanDiscoverySessionCallback#onMessageReceived(int, byte[])}. On a RESPONDER this * value is used to gate the acceptance of a connection request from only that * peer. A RESPONDER may specified a 0 - indicating that it will accept Loading wifi/java/android/net/wifi/nan/WifiNanDiscoverySessionCallback.java +20 −20 Original line number Diff line number Diff line Loading @@ -26,8 +26,8 @@ import java.lang.annotation.RetentionPolicy; * Base class for NAN session events callbacks. Should be extended by * applications wanting notifications. The callbacks are set when a * publish or subscribe session is created using * {@link WifiNanManager#publish(PublishConfig, WifiNanDiscoverySessionCallback)} or * {@link WifiNanManager#subscribe(SubscribeConfig, WifiNanDiscoverySessionCallback)} . * {@link WifiNanSession#publish(PublishConfig, WifiNanDiscoverySessionCallback)} or * {@link WifiNanSession#subscribe(SubscribeConfig, WifiNanDiscoverySessionCallback)} . * <p> * A single callback is set at session creation - it cannot be replaced. * Loading Loading @@ -72,7 +72,7 @@ public class WifiNanDiscoverySessionCallback { * Indicates transmission failure: this may be due to local transmission * failure or to no ACK received - remote device didn't receive the * sent message. Failure reason flag for * {@link WifiNanDiscoverySessionCallback#onMessageSendFail(int, int)} callback. * {@link WifiNanDiscoverySessionCallback#onMessageSendFailed(int, int)} callback. */ public static final int REASON_TX_FAIL = 3; Loading Loading @@ -100,7 +100,7 @@ public class WifiNanDiscoverySessionCallback { /** * Called when a publish operation is started successfully in response to a * {@link WifiNanManager#publish(PublishConfig, WifiNanDiscoverySessionCallback)} operation. * {@link WifiNanSession#publish(PublishConfig, WifiNanDiscoverySessionCallback)} operation. * * @param session The {@link WifiNanPublishDiscoverySession} used to control the * discovery session. Loading @@ -111,7 +111,7 @@ public class WifiNanDiscoverySessionCallback { /** * Called when a subscribe operation is started successfully in response to a * {@link WifiNanManager#subscribe(SubscribeConfig, WifiNanDiscoverySessionCallback)} operation. * {@link WifiNanSession#subscribe(SubscribeConfig, WifiNanDiscoverySessionCallback)} operation. * * @param session The {@link WifiNanSubscribeDiscoverySession} used to control the * discovery session. Loading @@ -121,19 +121,19 @@ public class WifiNanDiscoverySessionCallback { } /** * Called when a publish or subscribe discovery session configuration is update request * Called when a publish or subscribe discovery session configuration update request * succeeds. Called in response to * {@link WifiNanPublishDiscoverySession#updatePublish(PublishConfig)} or * {@link WifiNanSubscribeDiscoverySession#updateSubscribe(SubscribeConfig)}. */ public void onSessionConfigSuccess() { public void onSessionConfigUpdated() { /* empty */ } /** * Called when a publish or subscribe discovery session cannot be created: * {@link WifiNanManager#publish(PublishConfig, WifiNanDiscoverySessionCallback)} or * {@link WifiNanManager#subscribe(SubscribeConfig, WifiNanDiscoverySessionCallback)}, * {@link WifiNanSession#publish(PublishConfig, WifiNanDiscoverySessionCallback)} or * {@link WifiNanSession#subscribe(SubscribeConfig, WifiNanDiscoverySessionCallback)}, * or when a configuration update fails: * {@link WifiNanPublishDiscoverySession#updatePublish(PublishConfig)} or * {@link WifiNanSubscribeDiscoverySession#updateSubscribe(SubscribeConfig)}. Loading @@ -144,13 +144,13 @@ public class WifiNanDiscoverySessionCallback { * @param reason The failure reason using * {@code WifiNanDiscoverySessionCallback.REASON_*} codes. */ public void onSessionConfigFail(@SessionReasonCodes int reason) { public void onSessionConfigFailed(@SessionReasonCodes int reason) { /* empty */ } /** * Called when a discovery session (publish or subscribe) terminates. Termination may be due * to user-request (either directly through {@link WifiNanDiscoveryBaseSession#terminate()} or * to user-request (either directly through {@link WifiNanDiscoveryBaseSession#destroy()} or * application-specified expiration, e.g. {@link PublishConfig.Builder#setPublishCount(int)} * or {@link SubscribeConfig.Builder#setTtlSec(int)}) or due to a failure. * Loading @@ -163,31 +163,31 @@ public class WifiNanDiscoverySessionCallback { /** * Called when a discovery (publish or subscribe) operation results in a * match - when a peer is discovered. * service discovery. * * @param peerId The ID of the peer matching our discovery operation. * @param serviceSpecificInfo The service specific information (arbitrary * byte array) provided by the peer as part of its discovery * configuration. * @param matchFilter The filter (Tx on advertiser and Rx on listener) which * resulted in this match. * resulted in this service discovery. */ public void onMatch(int peerId, byte[] serviceSpecificInfo, byte[] matchFilter) { public void onServiceDiscovered(int peerId, byte[] serviceSpecificInfo, byte[] matchFilter) { /* empty */ } /** * Called in response to {@link WifiNanDiscoveryBaseSession#sendMessage(int, byte[], int)} * when a message is transmitted successfully - when it was received successfully by the peer * (corresponds to an ACK being received). * when a message is transmitted successfully - i.e. when it was received successfully by the * peer (corresponds to an ACK being received). * <p> * Note that either this callback or * {@link WifiNanDiscoverySessionCallback#onMessageSendFail(int, int)} will be * {@link WifiNanDiscoverySessionCallback#onMessageSendFailed(int, int)} will be * received - never both. * * @param messageId The arbitrary message ID specified when sending the message. */ public void onMessageSendSuccess(@SuppressWarnings("unused") int messageId) { public void onMessageSent(@SuppressWarnings("unused") int messageId) { /* empty */ } Loading @@ -198,14 +198,14 @@ public class WifiNanDiscoverySessionCallback { * event is received after all retries are exhausted. * <p> * Note that either this callback or * {@link WifiNanDiscoverySessionCallback#onMessageSendSuccess(int)} will be received * {@link WifiNanDiscoverySessionCallback#onMessageSent(int)} will be received * - never both. * * @param messageId The arbitrary message ID specified when sending the message. * @param reason The failure reason using * {@code WifiNanDiscoverySessionCallback.REASON_*} codes. */ public void onMessageSendFail(@SuppressWarnings("unused") int messageId, public void onMessageSendFailed(@SuppressWarnings("unused") int messageId, @SessionReasonCodes int reason) { /* empty */ } Loading Loading
wifi/java/android/net/wifi/nan/ConfigRequest.java +1 −1 Original line number Diff line number Diff line Loading @@ -23,7 +23,7 @@ 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#connect(android.os.Handler, ConfigRequest, WifiNanEventCallback)}. * {@link WifiNanManager#attach(android.os.Handler, WifiNanEventCallback)}. * Note that the actual achieved configuration may be different from the * requested configuration - since different applications may request different * configurations. Loading
wifi/java/android/net/wifi/nan/PublishConfig.java +3 −3 Original line number Diff line number Diff line Loading @@ -32,7 +32,7 @@ import java.util.Arrays; /** * Defines the configuration of a NAN publish session. Built using * {@link PublishConfig.Builder}. A publish session is created using * {@link WifiNanManager#publish(PublishConfig, WifiNanDiscoverySessionCallback)} or updated using * {@link WifiNanSession#publish(PublishConfig, WifiNanDiscoverySessionCallback)} or updated using * {@link WifiNanPublishDiscoverySession#updatePublish(PublishConfig)}. * * @hide PROPOSED_NAN_API Loading Loading @@ -323,7 +323,7 @@ public final class PublishConfig implements Parcelable { * {@link #setEnableTerminateNotification(boolean)} disables the callback]. * <p> * Optional. 0 by default - indicating the session doesn't terminate on its own. * Session will be terminated when {@link WifiNanDiscoveryBaseSession#terminate()} is * Session will be terminated when {@link WifiNanDiscoveryBaseSession#destroy()} is * called. * * @param publishCount Number of publish packets to broadcast. Loading @@ -349,7 +349,7 @@ public final class PublishConfig implements Parcelable { * {@link #setEnableTerminateNotification(boolean)} disables the callback]. * <p> * Optional. 0 by default - indicating the session doesn't terminate on its own. * Session will be terminated when {@link WifiNanDiscoveryBaseSession#terminate()} is * Session will be terminated when {@link WifiNanDiscoveryBaseSession#destroy()} is * called. * * @param ttlSec Lifetime of a publish session in seconds. Loading
wifi/java/android/net/wifi/nan/SubscribeConfig.java +4 −4 Original line number Diff line number Diff line Loading @@ -32,7 +32,7 @@ import java.util.Arrays; /** * Defines the configuration of a NAN subscribe session. Built using * {@link SubscribeConfig.Builder}. Subscribe is done using * {@link WifiNanManager#subscribe(SubscribeConfig, WifiNanDiscoverySessionCallback)} or * {@link WifiNanSession#subscribe(SubscribeConfig, WifiNanDiscoverySessionCallback)} or * {@link WifiNanSubscribeDiscoverySession#updateSubscribe(SubscribeConfig)}. * * @hide PROPOSED_NAN_API Loading Loading @@ -354,7 +354,7 @@ public final class SubscribeConfig implements Parcelable { * with {@link WifiNanDiscoverySessionCallback#TERMINATE_REASON_DONE}. * <p> * Optional. 0 by default - indicating the session doesn't terminate on its own. * Session will be terminated when {@link WifiNanDiscoveryBaseSession#terminate()} is * Session will be terminated when {@link WifiNanDiscoveryBaseSession#destroy()} is * called. * * @param subscribeCount Number of subscribe packets to broadcast. Loading @@ -379,7 +379,7 @@ public final class SubscribeConfig implements Parcelable { * {@link WifiNanDiscoverySessionCallback#TERMINATE_REASON_DONE}. * <p> * Optional. 0 by default - indicating the session doesn't terminate on its own. * Session will be terminated when {@link WifiNanDiscoveryBaseSession#terminate()} is * Session will be terminated when {@link WifiNanDiscoveryBaseSession#destroy()} is * called. * * @param ttlSec Lifetime of a subscribe session in seconds. Loading @@ -399,7 +399,7 @@ public final class SubscribeConfig implements Parcelable { * Sets the match style of the subscription - how are matches from a * single match session (corresponding to the same publish action on the * peer) reported to the host (using the * {@link WifiNanDiscoverySessionCallback#onMatch(int, byte[], byte[])} * {@link WifiNanDiscoverySessionCallback#onServiceDiscovered(int, byte[], byte[])} * ). The options are: only report the first match and ignore the rest * {@link SubscribeConfig#MATCH_STYLE_FIRST_ONLY} or report every single * match {@link SubscribeConfig#MATCH_STYLE_ALL} (the default). Loading
wifi/java/android/net/wifi/nan/WifiNanDiscoveryBaseSession.java +23 −20 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package android.net.wifi.nan; import android.annotation.Nullable; import android.annotation.SystemApi; import android.net.wifi.RttManager; import android.util.Log; Loading @@ -35,7 +36,7 @@ import java.lang.ref.WeakReference; * <li>Creating a network-specifier when requesting a NAN connection: * {@link #createNetworkSpecifier(int, int, byte[])}. * </ul> * The {@link #terminate()} method must be called to terminate discovery sessions once they are * The {@link #destroy()} method must be called to destroy discovery sessions once they are * no longer needed. * * @hide PROPOSED_NAN_API Loading Loading @@ -79,24 +80,24 @@ public class WifiNanDiscoveryBaseSession { mClientId = clientId; mSessionId = sessionId; mCloseGuard.open("terminate"); mCloseGuard.open("destroy"); } /** * Terminate the publish or subscribe session - free any resources, and stop * Destroy the publish or subscribe session - free any resources, and stop * transmitting packets on-air (for an active session) or listening for * matches (for a passive session). The session may not be used for any * additional operations after termination. * additional operations after its destruction. * <p> * This operation must be done on a session which is no longer needed. Otherwise system * resources will continue to be utilized until the application terminates. The only * resources will continue to be utilized until the application exits. The only * exception is a session for which we received a termination callback, * {@link WifiNanDiscoverySessionCallback#onSessionTerminated(int)}. */ public void terminate() { public void destroy() { WifiNanManager mgr = mMgr.get(); if (mgr == null) { Log.w(TAG, "terminate: called post GC on WifiNanManager"); Log.w(TAG, "destroy: called post GC on WifiNanManager"); return; } mgr.terminateSession(mClientId, mSessionId); Loading Loading @@ -127,7 +128,7 @@ public class WifiNanDiscoveryBaseSession { try { if (!mTerminated) { mCloseGuard.warnIfOpen(); terminate(); destroy(); } } finally { super.finalize(); Loading @@ -137,19 +138,20 @@ public class WifiNanDiscoveryBaseSession { /** * Sends a message to the specified destination. NAN messages are transmitted in the context * of a discovery session - executed subsequent to a publish/subscribe * {@link WifiNanDiscoverySessionCallback#onMatch(int, byte[], byte[])} event. * {@link WifiNanDiscoverySessionCallback#onServiceDiscovered(int, byte[], byte[])} event. * <p> * NAN messages are not guaranteed delivery. Callbacks on * {@link WifiNanDiscoverySessionCallback} indicate message was transmitted successfully, * {@link WifiNanDiscoverySessionCallback#onMessageSendSuccess(int)}, or transmission failed * {@link WifiNanDiscoverySessionCallback#onMessageSent(int)}, or transmission failed * (possibly after several retries) - * {@link WifiNanDiscoverySessionCallback#onMessageSendFail(int, int)}. * {@link WifiNanDiscoverySessionCallback#onMessageSendFailed(int, int)}. * <p> * The peer will get a callback indicating a message was received using * {@link WifiNanDiscoverySessionCallback#onMessageReceived(int, byte[])}. * * @param peerId The peer's ID for the message. Must be a result of an * {@link WifiNanDiscoverySessionCallback#onMatch(int, byte[], byte[])} or * {@link WifiNanDiscoverySessionCallback#onServiceDiscovered(int, byte[], byte[])} * or * {@link WifiNanDiscoverySessionCallback#onMessageReceived(int, byte[])} events. * @param message The message to be transmitted. * @param messageId An arbitrary integer used by the caller to identify the message. The same Loading Loading @@ -179,13 +181,13 @@ public class WifiNanDiscoveryBaseSession { /** * Sends a message to the specified destination. NAN messages are transmitted in the context * of a discovery session - executed subsequent to a publish/subscribe * {@link WifiNanDiscoverySessionCallback#onMatch(int, byte[], byte[])} event. * {@link WifiNanDiscoverySessionCallback#onServiceDiscovered(int, byte[], byte[])} event. * <p> * NAN messages are not guaranteed delivery. Callbacks on * {@link WifiNanDiscoverySessionCallback} indicate message was transmitted successfully, * {@link WifiNanDiscoverySessionCallback#onMessageSendSuccess(int)}, or transmission failed * {@link WifiNanDiscoverySessionCallback#onMessageSent(int)}, or transmission failed * (possibly after several retries) - * {@link WifiNanDiscoverySessionCallback#onMessageSendFail(int, int)}. * {@link WifiNanDiscoverySessionCallback#onMessageSendFailed(int, int)}. * <p> * The peer will get a callback indicating a message was received using * {@link WifiNanDiscoverySessionCallback#onMessageReceived(int, byte[])}. Loading @@ -193,7 +195,8 @@ public class WifiNanDiscoveryBaseSession { * 0. * * @param peerId The peer's ID for the message. Must be a result of an * {@link WifiNanDiscoverySessionCallback#onMatch(int, byte[], byte[])} or * {@link WifiNanDiscoverySessionCallback#onServiceDiscovered(int, byte[], byte[])} * or * {@link WifiNanDiscoverySessionCallback#onMessageReceived(int, byte[])} events. * @param message The message to be transmitted. * @param messageId An arbitrary integer used by the caller to identify the message. The same Loading @@ -207,7 +210,7 @@ public class WifiNanDiscoveryBaseSession { /** * Start a ranging operation with the specified peers. The peer IDs are obtained from an * {@link WifiNanDiscoverySessionCallback#onMatch(int, byte[], byte[])} or * {@link WifiNanDiscoverySessionCallback#onServiceDiscovered(int, byte[], byte[])} or * {@link WifiNanDiscoverySessionCallback#onMessageReceived(int, byte[])} operation - can only * range devices which are part of an ongoing discovery session. * Loading Loading @@ -250,7 +253,7 @@ public class WifiNanDiscoveryBaseSession { * {@link WifiNanManager#WIFI_NAN_DATA_PATH_ROLE_INITIATOR} or * {@link WifiNanManager#WIFI_NAN_DATA_PATH_ROLE_RESPONDER} * @param peerId The peer ID obtained through * {@link WifiNanDiscoverySessionCallback#onMatch(int, byte[], byte[])} or * {@link WifiNanDiscoverySessionCallback#onServiceDiscovered(int, byte[], byte[])} or * {@link WifiNanDiscoverySessionCallback#onMessageReceived(int, byte[])}. On a RESPONDER this * value is used to gate the acceptance of a connection request from only that * peer. A RESPONDER may specified a 0 - indicating that it will accept Loading
wifi/java/android/net/wifi/nan/WifiNanDiscoverySessionCallback.java +20 −20 Original line number Diff line number Diff line Loading @@ -26,8 +26,8 @@ import java.lang.annotation.RetentionPolicy; * Base class for NAN session events callbacks. Should be extended by * applications wanting notifications. The callbacks are set when a * publish or subscribe session is created using * {@link WifiNanManager#publish(PublishConfig, WifiNanDiscoverySessionCallback)} or * {@link WifiNanManager#subscribe(SubscribeConfig, WifiNanDiscoverySessionCallback)} . * {@link WifiNanSession#publish(PublishConfig, WifiNanDiscoverySessionCallback)} or * {@link WifiNanSession#subscribe(SubscribeConfig, WifiNanDiscoverySessionCallback)} . * <p> * A single callback is set at session creation - it cannot be replaced. * Loading Loading @@ -72,7 +72,7 @@ public class WifiNanDiscoverySessionCallback { * Indicates transmission failure: this may be due to local transmission * failure or to no ACK received - remote device didn't receive the * sent message. Failure reason flag for * {@link WifiNanDiscoverySessionCallback#onMessageSendFail(int, int)} callback. * {@link WifiNanDiscoverySessionCallback#onMessageSendFailed(int, int)} callback. */ public static final int REASON_TX_FAIL = 3; Loading Loading @@ -100,7 +100,7 @@ public class WifiNanDiscoverySessionCallback { /** * Called when a publish operation is started successfully in response to a * {@link WifiNanManager#publish(PublishConfig, WifiNanDiscoverySessionCallback)} operation. * {@link WifiNanSession#publish(PublishConfig, WifiNanDiscoverySessionCallback)} operation. * * @param session The {@link WifiNanPublishDiscoverySession} used to control the * discovery session. Loading @@ -111,7 +111,7 @@ public class WifiNanDiscoverySessionCallback { /** * Called when a subscribe operation is started successfully in response to a * {@link WifiNanManager#subscribe(SubscribeConfig, WifiNanDiscoverySessionCallback)} operation. * {@link WifiNanSession#subscribe(SubscribeConfig, WifiNanDiscoverySessionCallback)} operation. * * @param session The {@link WifiNanSubscribeDiscoverySession} used to control the * discovery session. Loading @@ -121,19 +121,19 @@ public class WifiNanDiscoverySessionCallback { } /** * Called when a publish or subscribe discovery session configuration is update request * Called when a publish or subscribe discovery session configuration update request * succeeds. Called in response to * {@link WifiNanPublishDiscoverySession#updatePublish(PublishConfig)} or * {@link WifiNanSubscribeDiscoverySession#updateSubscribe(SubscribeConfig)}. */ public void onSessionConfigSuccess() { public void onSessionConfigUpdated() { /* empty */ } /** * Called when a publish or subscribe discovery session cannot be created: * {@link WifiNanManager#publish(PublishConfig, WifiNanDiscoverySessionCallback)} or * {@link WifiNanManager#subscribe(SubscribeConfig, WifiNanDiscoverySessionCallback)}, * {@link WifiNanSession#publish(PublishConfig, WifiNanDiscoverySessionCallback)} or * {@link WifiNanSession#subscribe(SubscribeConfig, WifiNanDiscoverySessionCallback)}, * or when a configuration update fails: * {@link WifiNanPublishDiscoverySession#updatePublish(PublishConfig)} or * {@link WifiNanSubscribeDiscoverySession#updateSubscribe(SubscribeConfig)}. Loading @@ -144,13 +144,13 @@ public class WifiNanDiscoverySessionCallback { * @param reason The failure reason using * {@code WifiNanDiscoverySessionCallback.REASON_*} codes. */ public void onSessionConfigFail(@SessionReasonCodes int reason) { public void onSessionConfigFailed(@SessionReasonCodes int reason) { /* empty */ } /** * Called when a discovery session (publish or subscribe) terminates. Termination may be due * to user-request (either directly through {@link WifiNanDiscoveryBaseSession#terminate()} or * to user-request (either directly through {@link WifiNanDiscoveryBaseSession#destroy()} or * application-specified expiration, e.g. {@link PublishConfig.Builder#setPublishCount(int)} * or {@link SubscribeConfig.Builder#setTtlSec(int)}) or due to a failure. * Loading @@ -163,31 +163,31 @@ public class WifiNanDiscoverySessionCallback { /** * Called when a discovery (publish or subscribe) operation results in a * match - when a peer is discovered. * service discovery. * * @param peerId The ID of the peer matching our discovery operation. * @param serviceSpecificInfo The service specific information (arbitrary * byte array) provided by the peer as part of its discovery * configuration. * @param matchFilter The filter (Tx on advertiser and Rx on listener) which * resulted in this match. * resulted in this service discovery. */ public void onMatch(int peerId, byte[] serviceSpecificInfo, byte[] matchFilter) { public void onServiceDiscovered(int peerId, byte[] serviceSpecificInfo, byte[] matchFilter) { /* empty */ } /** * Called in response to {@link WifiNanDiscoveryBaseSession#sendMessage(int, byte[], int)} * when a message is transmitted successfully - when it was received successfully by the peer * (corresponds to an ACK being received). * when a message is transmitted successfully - i.e. when it was received successfully by the * peer (corresponds to an ACK being received). * <p> * Note that either this callback or * {@link WifiNanDiscoverySessionCallback#onMessageSendFail(int, int)} will be * {@link WifiNanDiscoverySessionCallback#onMessageSendFailed(int, int)} will be * received - never both. * * @param messageId The arbitrary message ID specified when sending the message. */ public void onMessageSendSuccess(@SuppressWarnings("unused") int messageId) { public void onMessageSent(@SuppressWarnings("unused") int messageId) { /* empty */ } Loading @@ -198,14 +198,14 @@ public class WifiNanDiscoverySessionCallback { * event is received after all retries are exhausted. * <p> * Note that either this callback or * {@link WifiNanDiscoverySessionCallback#onMessageSendSuccess(int)} will be received * {@link WifiNanDiscoverySessionCallback#onMessageSent(int)} will be received * - never both. * * @param messageId The arbitrary message ID specified when sending the message. * @param reason The failure reason using * {@code WifiNanDiscoverySessionCallback.REASON_*} codes. */ public void onMessageSendFail(@SuppressWarnings("unused") int messageId, public void onMessageSendFailed(@SuppressWarnings("unused") int messageId, @SessionReasonCodes int reason) { /* empty */ } Loading