public static interface RouterConnectionClient.ConnectionHandler
It exposes the following groups of callback methods in accordance with ConnectionHandler AIDL api:
void onGetActiveNetwork(NetInfo net) void onGetNetworks(NetInfo[] nets) void onNetworkActivated(NetInfo net) void onNetworkConnecting(NetInfo net) void onNetworkConnected(NetInfo net) void onNetworkDisconnected(NetInfo net) void onNetworkConnectionFailed(NetInfo net)
onSearchStart(DeviceInfo groupLeader) onSearchFoundDevice(DeviceInfo device, boolean useSSL) onSearchComplete()
onConnected(DeviceInfo peerInfo) onConnecting(DeviceInfo device, byte[] token) onConnectionFailed(DeviceInfo device, int rejectCode) onDisconnected(DeviceInfo peerInfo)
onSetConnectionInfo() onGetConnectionInfo(String devName, boolean useSSL, int liveTime, int connTime, int searchTime) onGetDeviceInfo(DeviceInfo device) onGetPeerDevices(DeviceInfo[] devices)
Modifier and Type | Method and Description |
---|---|
void |
onConnected(DeviceInfo peerInfo)
Notify client that a peer device successfully connected to this device;
either because the client accept peer connection request or peer accept the client's
connection request.
|
void |
onConnecting(DeviceInfo device,
byte[] token)
Notify client a peer device is trying to connect to this device.
|
void |
onConnectionFailed(DeviceInfo device,
int rejectCode)
Notify client its attempt to connect to peer device failed.
|
void |
onDisconnected(DeviceInfo peerInfo)
Notify client a peer device disconnected;
either because the client or its peer called disconnect() api; or
because network failed.
|
void |
onError(java.lang.String errInfo)
Notify clients about two kinds of errors:
errors happening at server processing.
|
void |
onGetActiveNetwork(NetInfo net)
Pass to clients info about the network used to connect to peer devices.
|
void |
onGetConnectionInfo(java.lang.String devName,
boolean useSSL,
int liveTime,
int connTime,
int searchTime)
Reply to client connection related settings currently active at Connection Service;
This is the response to getConnectionInfo() api call.
|
void |
onGetDeviceInfo(DeviceInfo device)
Reply to client info about this device; This is the response to getDeviceInfo() api call.
|
void |
onGetNetworks(NetInfo[] nets)
Pass to clients info about currently attached networks detected by ConnectionService.
|
void |
onGetPeerDevices(DeviceInfo[] devices)
Reply to client info about peer devices connected to this device.
|
void |
onNetworkActivated(NetInfo net)
Pass to clients info about network activated.
|
void |
onNetworkConnected(NetInfo net)
Notify clients that ConnectionService detects a new network.
|
void |
onNetworkConnecting(NetInfo net)
Notify clients that network connection is in process.
|
void |
onNetworkConnectionFailed(NetInfo net)
Notify clients that network connection attempt failed.
|
void |
onNetworkDisconnected(NetInfo net)
Notify clients that a network is disconnected.
|
void |
onSearchComplete()
Notify clients current active search session completes, either because clients
called stopSearch() or search session timeout.
|
void |
onSearchFoundDevice(DeviceInfo device,
boolean useSSL)
Notify clients in a search session a device is found.
|
void |
onSearchStart(DeviceInfo groupLeader)
Notify client a search session started; It is the response to startSearch() api call.
|
void |
onSetConnectionInfo()
Notify client its call to setConnectionInfo() api call succeed and
connection related settings (device name, use SSL, connection timeout, etc.)
have been updated successfully at Connection Service.
|
void onError(java.lang.String errInfo)
errInfo
- the detailed error messagevoid onGetNetworks(NetInfo[] nets)
nets
- info about current networks to which the device is attached.void onGetActiveNetwork(NetInfo net)
net
- info about the network actively used to communicate with peer devices.void onNetworkConnected(NetInfo net)
net
- info about a network this device is newly attached.void onNetworkConnecting(NetInfo net)
net
- info about connecting network.void onNetworkConnectionFailed(NetInfo net)
net
- info about network.void onNetworkDisconnected(NetInfo net)
net
- info about disconnected network.void onNetworkActivated(NetInfo net)
net
- info of the network activated.void onSearchStart(DeviceInfo groupLeader)
groupLeader
- info of leader device which may run hotspot or own wifi
direct group. It is the enabler for a group of devices
to discover each other.void onSearchFoundDevice(DeviceInfo device, boolean useSSL)
device
- info of found device (name, address, port number).useSSL
- does connection to this device use TLS/SSL or not.void onSearchComplete()
void onConnecting(DeviceInfo device, byte[] token)
device
- peer device info which try to connecttoken
- binary data passed by peer device as authentication token.void onConnectionFailed(DeviceInfo device, int rejectCode)
device
- target peer device the client try to connectrejectCode
- reason of connection failure.void onConnected(DeviceInfo peerInfo)
peerInfo
- info of connected device.void onDisconnected(DeviceInfo peerInfo)
peerInfo
- info of disconnected device.void onSetConnectionInfo()
void onGetConnectionInfo(java.lang.String devName, boolean useSSL, int liveTime, int connTime, int searchTime)
devName
- name of this deviceuseSSL
- does this device use TLS/SSL connect to peer devices or not.liveTime
- the period between successive verifications of liveness of peer device.connTime
- peer device connection timeout.searchTime
- search session timeout.void onGetDeviceInfo(DeviceInfo device)
device
- info of this device (name, address, port).void onGetPeerDevices(DeviceInfo[] devices)
devices
- peer devices currently connected.