See: Description
Interface | Description |
---|---|
RouterConnectionClient.ConnectionHandler |
ConnectionHandler exposes client side async messaging one-way AIDL api to allow ConnectionService call back to
notify events such as network attachment and detachment, device connection and disconnection.
|
RouterGroupClient.GroupHandler |
GroupHandler exposes client side async messaging one-way AIDL api to allow GroupService notify
events such as peer devices joining group, peer devices leaving a group or receiving a message.
|
Class | Description |
---|---|
DeviceInfo |
Info of a device in peer-peer network:
its name, address and port number.
|
NetInfo |
Info of the network connecting peer devices: its type (wifi, hotspot, ...),
name (SSID,...), encrypt password, interface name, support multicast or not, etc.
|
Router |
Messaging api for clients to communicate with Router services using intents
and messenger.
|
Router.ConnFailureCode |
Reasons why peer device connections failed.
|
Router.Intent |
Intenting api allows clients communicate with Router services using intents;
clients will send intents/messages to Router services by calling startService() and
received intents/messages from Router services by registering BroadcastReceivers.
|
Router.MsgId |
Messenger api allows clients communicate with Router services using
"Messenger" design pattern with messages identified by message ids;
clients will use a messenger to send messages to Router services and
register another messenger to receive messages from Router services;
there is 1-1 correspondence between intent names and message ids.
|
Router.MsgKey |
key names for indexing data items in message bundle.
|
RouterConnectionClient |
RouterConnectionClient wrapper class is the preferred way to access the asynchronous one-way AIDL api of Router Connection Service.
|
RouterGroupClient |
RouterGroupClient wrapper class is the preferred way to access the asynchronous one-way AIDL api of Router Group Service.
|
PeerDeviceNet APIs provides asynchronous messaging interfaces between clients and Router services (Connection Service and Group Service). Router services will expose their APIs as asynchronous messages (or one-way AIDL methods). Similarly clients will provide async messaging (or one-way AIDL methods) APIs to allow Router services to call back or notify clients for events such as network attachment and detachment, peer device connection and disconnection.
Both runtime/Router and api have been published as two jar/aar files at Maven Central. You can download the latest jars from MavenCentral Site, or grab via Maven or gradle as following:
These asynchronous messaging apis between clients and Router services can be accessed in three ways:
Router.Intent
class and "extra" data keys at
Router.MsgKey
class which you get when you add the client jar file
to your project.
RouterConnectionClient
and RouterGroupClient
. These wrapper classes also handle
some common book-keeping for you. There is also DeviceInfo
class and
NetInfo
class used at aidl apis which defines information about devices and
networks.
Router.MsgId
class and message data keys at
Router.MsgKey
class.