public class WifiNanSession extends Object
WifiNanPublishSession
and WifiNanSubscribeSession
.Modifier and Type | Field and Description |
---|---|
protected WifiNanManager |
mManager |
protected int |
mSessionId |
Constructor and Description |
---|
WifiNanSession(WifiNanManager manager,
int sessionId) |
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Destroy the current publish or subscribe session.
|
protected void |
finalize() |
void |
sendMessage(int peerId,
byte[] message,
int messageLength,
int messageId)
Sends a message to the specified destination.
|
void |
stop()
Terminate the current publish or subscribe session - i.e. stop
transmitting packet on-air (for an active session) or listening for
matches (for a passive session).
|
protected WifiNanManager mManager
protected int mSessionId
public WifiNanSession(WifiNanManager manager, int sessionId)
public void stop()
public void destroy()
stop()
function but in addition destroys the session -
it will not be able to receive any messages or to be restarted at a later
time.protected void finalize() throws Throwable
public void sendMessage(int peerId, byte[] message, int messageLength, int messageId)
WifiNanSessionListener.onMatch(int, byte[], int, byte[], int)
event.peerId
- The peer's ID for the message. Must be a result of an
WifiNanSessionListener.onMatch(int, byte[], int, byte[], int)
event.message
- The message to be transmitted.messageLength
- The number of bytes from the message
to be
transmitted.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.