* {@hide}
*/
public void sendMessage(int sessionId, int peerId, byte[] message, int messageLength,
- int messageId) {
+ int messageId, int retryCount) {
if (VDBG) {
Log.v(TAG, "sendMessage(): sessionId=" + sessionId + ", peerId=" + peerId
- + ", messageLength=" + messageLength + ", messageId=" + messageId);
+ + ", messageLength=" + messageLength + ", messageId=" + messageId
+ + ", retryCount=" + retryCount);
}
int clientId;
}
try {
- mService.sendMessage(clientId, sessionId, peerId, message, messageLength, messageId);
+ mService.sendMessage(clientId, sessionId, peerId, message, messageLength, messageId,
+ retryCount);
} catch (RemoteException e) {
e.rethrowAsRuntimeException();
}
private static final boolean DBG = false;
private static final boolean VDBG = false; // STOPSHIP if true
+ public static final int MAX_SEND_RETRY_COUNT = 5;
+
/**
* @hide
*/
}
/**
- * Sends a message to the specified destination. Message transmission is
- * part of the current discovery session - i.e. executed subsequent to a
- * publish/subscribe
- * {@link WifiNanSessionCallback#onMatch(int, byte[], int, byte[], int)}
- * event.
+ * Sends a message to the specified destination. Message transmission is part of the current
+ * discovery session - i.e. executed subsequent to a publish/subscribe
+ * {@link WifiNanSessionCallback#onMatch(int, byte[], int, byte[], int)} event.
*
* @param peerId The peer's ID for the message. Must be a result of an
- * {@link WifiNanSessionCallback#onMatch(int, byte[], int, byte[], int)}
- * event.
+ * {@link WifiNanSessionCallback#onMatch(int, byte[], int, byte[], int)} event.
* @param message The message to be transmitted.
- * @param messageLength The number of bytes from the {@code message} to be
- * transmitted.
- * @param messageId An arbitrary integer used by the caller to identify the
- * message. The same integer ID will be returned in the callbacks
- * indicated message send success or failure.
+ * @param messageLength The number of bytes from the {@code message} to be transmitted.
+ * @param messageId An arbitrary integer used by the caller to identify the message. The same
+ * integer ID will be returned in the callbacks indicated message send success or
+ * failure.
+ * @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
+ * (note: no retransmissions are attempted in other failure cases). A value of 0
+ * indicates no retries. Max possible value is {@link #MAX_SEND_RETRY_COUNT}.
*/
- public void sendMessage(int peerId, byte[] message, int messageLength, int messageId) {
+ public void sendMessage(int peerId, byte[] message, int messageLength, int messageId,
+ int retryCount) {
if (mTerminated) {
Log.w(TAG, "sendMessage: called on terminated session");
return;
return;
}
- mgr.sendMessage(mSessionId, peerId, message, messageLength, messageId);
+ mgr.sendMessage(mSessionId, peerId, message, messageLength, messageId, retryCount);
}
}
/**
+ * Sends a message to the specified destination. Message transmission is part of the current
+ * discovery session - i.e. executed subsequent to a publish/subscribe
+ * {@link WifiNanSessionCallback#onMatch(int, byte[], int, byte[], int)} event. This is
+ * equivalent to {@link #sendMessage(int, byte[], int, int, int)} with a {@code retryCount} of
+ * 0.
+ *
+ * @param peerId The peer's ID for the message. Must be a result of an
+ * {@link WifiNanSessionCallback#onMatch(int, byte[], int, byte[], int)} event.
+ * @param message The message to be transmitted.
+ * @param messageLength The number of bytes from the {@code message} to be transmitted.
+ * @param messageId An arbitrary integer used by the caller to identify the message. The same
+ * integer ID will be returned in the callbacks indicated message send success or
+ * failure.
+ */
+ public void sendMessage(int peerId, byte[] message, int messageLength, int messageId) {
+ sendMessage(peerId, message, messageLength, messageId, 0);
+ }
+
+ /**
* Start a ranging operation with the specified peers. The peer IDs are obtained from an
* {@link WifiNanSessionCallback#onMatch(int, byte[], int, byte[], int)} or
* {@link WifiNanSessionCallback#onMessageReceived(int, byte[], int)} operation - i.e. can only