Merge "[NAN] Reorder parameters of send message method(s) per API review"
This commit is contained in:
@@ -31,8 +31,8 @@ import java.lang.ref.WeakReference;
|
|||||||
* {@link WifiNanPublishDiscoverySession} and {@link WifiNanSubscribeDiscoverySession}. This
|
* {@link WifiNanPublishDiscoverySession} and {@link WifiNanSubscribeDiscoverySession}. This
|
||||||
* class provides functionality common to both publish and subscribe discovery sessions:
|
* class provides functionality common to both publish and subscribe discovery sessions:
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>Sending messages: {@link #sendMessage(int, byte[], int)} or
|
* <li>Sending messages: {@link #sendMessage(int, int, byte[])} or
|
||||||
* {@link #sendMessage(int, byte[], int, int)} methods.
|
* {@link #sendMessage(int, int, byte[], int)} methods.
|
||||||
* <li>Creating a network-specifier when requesting a NAN connection:
|
* <li>Creating a network-specifier when requesting a NAN connection:
|
||||||
* {@link #createNetworkSpecifier(int, int, byte[])}.
|
* {@link #createNetworkSpecifier(int, int, byte[])}.
|
||||||
* </ul>
|
* </ul>
|
||||||
@@ -61,7 +61,7 @@ public class WifiNanDiscoveryBaseSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the maximum permitted retry count when sending messages using
|
* Return the maximum permitted retry count when sending messages using
|
||||||
* {@link #sendMessage(int, byte[], int, int)}.
|
* {@link #sendMessage(int, int, byte[], int)}.
|
||||||
*
|
*
|
||||||
* @return Maximum retry count when sending messages.
|
* @return Maximum retry count when sending messages.
|
||||||
*/
|
*/
|
||||||
@@ -153,17 +153,17 @@ public class WifiNanDiscoveryBaseSession {
|
|||||||
* {@link WifiNanDiscoverySessionCallback#onServiceDiscovered(int, byte[], byte[])}
|
* {@link WifiNanDiscoverySessionCallback#onServiceDiscovered(int, byte[], byte[])}
|
||||||
* or
|
* or
|
||||||
* {@link WifiNanDiscoverySessionCallback#onMessageReceived(int, byte[])} events.
|
* {@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
|
* @param messageId An arbitrary integer used by the caller to identify the message. The same
|
||||||
* integer ID will be returned in the callbacks indicating message send success or
|
* integer ID will be returned in the callbacks indicating message send success or
|
||||||
* failure. The {@code messageId} is not used internally by the NAN service - it
|
* failure. The {@code messageId} is not used internally by the NAN service - it
|
||||||
* can be arbitrary and non-unique.
|
* can be arbitrary and non-unique.
|
||||||
|
* @param message The message to be transmitted.
|
||||||
* @param retryCount An integer specifying how many additional service-level (as opposed to PHY
|
* @param retryCount An integer specifying how many additional service-level (as opposed to PHY
|
||||||
* or MAC level) retries should be attempted if there is no ACK from the receiver
|
* or MAC level) retries should be attempted if there is no ACK from the receiver
|
||||||
* (note: no retransmissions are attempted in other failure cases). A value of 0
|
* (note: no retransmissions are attempted in other failure cases). A value of 0
|
||||||
* indicates no retries. Max permitted value is {@link #getMaxSendRetryCount()}.
|
* indicates no retries. Max permitted value is {@link #getMaxSendRetryCount()}.
|
||||||
*/
|
*/
|
||||||
public void sendMessage(int peerId, @Nullable byte[] message, int messageId, int retryCount) {
|
public void sendMessage(int peerId, int messageId, @Nullable byte[] message, int retryCount) {
|
||||||
if (mTerminated) {
|
if (mTerminated) {
|
||||||
Log.w(TAG, "sendMessage: called on terminated session");
|
Log.w(TAG, "sendMessage: called on terminated session");
|
||||||
return;
|
return;
|
||||||
@@ -191,21 +191,21 @@ public class WifiNanDiscoveryBaseSession {
|
|||||||
* <p>
|
* <p>
|
||||||
* The peer will get a callback indicating a message was received using
|
* The peer will get a callback indicating a message was received using
|
||||||
* {@link WifiNanDiscoverySessionCallback#onMessageReceived(int, byte[])}.
|
* {@link WifiNanDiscoverySessionCallback#onMessageReceived(int, byte[])}.
|
||||||
* Equivalent to {@link #sendMessage(int, byte[], int, int)} with a {@code retryCount} of
|
* Equivalent to {@link #sendMessage(int, int, byte[], int)} with a {@code retryCount} of
|
||||||
* 0.
|
* 0.
|
||||||
*
|
*
|
||||||
* @param peerId The peer's ID for the message. Must be a result of an
|
* @param peerId The peer's ID for the message. Must be a result of an
|
||||||
* {@link WifiNanDiscoverySessionCallback#onServiceDiscovered(int, byte[], byte[])}
|
* {@link WifiNanDiscoverySessionCallback#onServiceDiscovered(int, byte[], byte[])}
|
||||||
* or
|
* or
|
||||||
* {@link WifiNanDiscoverySessionCallback#onMessageReceived(int, byte[])} events.
|
* {@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
|
* @param messageId An arbitrary integer used by the caller to identify the message. The same
|
||||||
* integer ID will be returned in the callbacks indicating message send success or
|
* integer ID will be returned in the callbacks indicating message send success or
|
||||||
* failure. The {@code messageId} is not used internally by the NAN service - it
|
* failure. The {@code messageId} is not used internally by the NAN service - it
|
||||||
* can be arbitrary and non-unique.
|
* can be arbitrary and non-unique.
|
||||||
|
* @param message The message to be transmitted.
|
||||||
*/
|
*/
|
||||||
public void sendMessage(int peerId, @Nullable byte[] message, int messageId) {
|
public void sendMessage(int peerId, int messageId, @Nullable byte[] message) {
|
||||||
sendMessage(peerId, message, messageId, 0);
|
sendMessage(peerId, messageId, message, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ import java.util.Arrays;
|
|||||||
* the session {@link WifiNanPublishDiscoverySession#updatePublish(PublishConfig)} and
|
* the session {@link WifiNanPublishDiscoverySession#updatePublish(PublishConfig)} and
|
||||||
* {@link WifiNanSubscribeDiscoverySession#updateSubscribe(SubscribeConfig)}. Sessions can also
|
* {@link WifiNanSubscribeDiscoverySession#updateSubscribe(SubscribeConfig)}. Sessions can also
|
||||||
* be used to send messages using the
|
* be used to send messages using the
|
||||||
* {@link WifiNanDiscoveryBaseSession#sendMessage(int, byte[], int)} APIs. When an application
|
* {@link WifiNanDiscoveryBaseSession#sendMessage(int, int, byte[])} APIs. When an application
|
||||||
* is finished with a discovery session it <b>must</b> terminate it using the
|
* is finished with a discovery session it <b>must</b> terminate it using the
|
||||||
* {@link WifiNanDiscoveryBaseSession#destroy()} API.
|
* {@link WifiNanDiscoveryBaseSession#destroy()} API.
|
||||||
* <p>
|
* <p>
|
||||||
|
|||||||
Reference in New Issue
Block a user