public class WifiNanManager extends Object
Context.getSystemService(Context.WIFI_NAN_SERVICE)
.
The class provides access to:
Constructor and Description |
---|
WifiNanManager(IWifiNanManager service) |
Modifier and Type | Method and Description |
---|---|
void |
connect(WifiNanEventListener listener,
int events)
Re-connect to the Wi-Fi NAN service - enabling the application to execute
WifiNanManager APIs. |
void |
destroySession(int sessionId) |
void |
disconnect()
Disconnect from the Wi-Fi NAN service and destroy all outstanding
operations - i.e. all publish and subscribes are terminated, any
outstanding data-link is shut-down, and all requested NAN configurations
are cancelled.
|
void |
publish(int sessionId,
PublishData publishData,
PublishSettings publishSettings) |
WifiNanPublishSession |
publish(PublishData publishData,
PublishSettings publishSettings,
WifiNanSessionListener listener,
int events)
Request a NAN publish session.
|
WifiNanPublishSession |
publishRaw(PublishData publishData,
PublishSettings publishSettings,
WifiNanSessionListener listener,
int events)
Same as publish(*) but does not modify the event flag
|
void |
requestConfig(ConfigRequest configRequest)
Requests a NAN configuration, specified by
ConfigRequest . |
void |
sendMessage(int sessionId,
int peerId,
byte[] message,
int messageLength,
int messageId) |
void |
stopSession(int sessionId) |
void |
subscribe(int sessionId,
SubscribeData subscribeData,
SubscribeSettings subscribeSettings) |
WifiNanSubscribeSession |
subscribe(SubscribeData subscribeData,
SubscribeSettings subscribeSettings,
WifiNanSessionListener listener,
int events)
Request a NAN subscribe session.
|
WifiNanSubscribeSession |
subscribeRaw(SubscribeData subscribeData,
SubscribeSettings subscribeSettings,
WifiNanSessionListener listener,
int events)
Same as subscribe(*) but does not modify the event flag
|
public void connect(WifiNanEventListener listener, int events)
WifiNanManager
APIs. Application don't normally need to call this
API since it is executed in the constructor. However, applications which
have explicitly disconnect()
need to call this
function to re-connect.listener
- A listener extended from WifiNanEventListener
.events
- The set of events to be delivered to the listener
.
OR'd event flags from NanEventListener.LISTEN*
.public void disconnect()
An application may then re-connect using
connect(WifiNanEventListener, int)
.
public void requestConfig(ConfigRequest configRequest)
ConfigRequest
. Note
that NAN is a shared resource and the device can only be a member of a
single cluster. Thus the service may merge configuration requests from
multiple applications and configure NAN differently from individual
requests.
The WifiNanEventListener.onConfigCompleted(ConfigRequest)
will be
called when configuration is completed (if a listener is registered for
this specific event).
configRequest
- The requested NAN configuration.public WifiNanPublishSession publish(PublishData publishData, PublishSettings publishSettings, WifiNanSessionListener listener, int events)
NanSessionListener.on*
.publishData
- The PublishData
specifying the contents of the
publish session.publishSettings
- The PublishSettings
specifying the
settings for the publish session.listener
- The WifiNanSessionListener
derived objects to be used
for the event callbacks specified by events
.events
- The list of events to be delivered to the listener
object. An OR'd value of NanSessionListener.LISTEN_*
.WifiNanPublishSession
which can be used to further
control the publish session.public WifiNanPublishSession publishRaw(PublishData publishData, PublishSettings publishSettings, WifiNanSessionListener listener, int events)
public void publish(int sessionId, PublishData publishData, PublishSettings publishSettings)
public WifiNanSubscribeSession subscribe(SubscribeData subscribeData, SubscribeSettings subscribeSettings, WifiNanSessionListener listener, int events)
NanSessionListener.on*
.subscribeData
- The SubscribeData
specifying the contents of
the subscribe session.subscribeSettings
- The SubscribeSettings
specifying the
settings for the subscribe session.listener
- The WifiNanSessionListener
derived objects to be used
for the event callbacks specified by events
.events
- The list of events to be delivered to the listener
object. An OR'd value of NanSessionListener.LISTEN_*
.WifiNanSubscribeSession
which can be used to further
control the subscribe session.public WifiNanSubscribeSession subscribeRaw(SubscribeData subscribeData, SubscribeSettings subscribeSettings, WifiNanSessionListener listener, int events)
public void subscribe(int sessionId, SubscribeData subscribeData, SubscribeSettings subscribeSettings)
public void stopSession(int sessionId)
public void destroySession(int sessionId)
public void sendMessage(int sessionId, int peerId, byte[] message, int messageLength, int messageId)