public interface KaaChannelManager
class SpecificDataChannel implements KaaDataChannel {...}
...
SpecificDataChannel dataChannel1 = new SpecificDataChannel();
kaaClient.getChannelManager().addChannel(dataChannel1);
The code above registers new data channel in the KaaChannelManager instance.
This channel will be used by each transport abstraction which is supported by
this channel (See KaaDataChannel.getSupportedTransportTypes()
).TransportType
for data transferring. For example, if there are two KaaDataChannel
implementations ChannelA and ChannelB such as:
ChannelDirection.BIDIRECTIONAL
)
for transport types [TransportType.EVENT
, TransportType.LOGGING
];
ChannelDirection.UP
)
for [TransportType.EVENT
].
addChannel(KaaDataChannel)
in the following order:
ChannelA channelA = new ChannelA();
ChannelB channelB = new ChannelB();
kaaClient.getChannelManager().addChannel(channelA);
kaaClient.getChannelManager().addChannel(channelB);
then ChannelA instance will be used to receive TransportType.EVENT
and TransportType.LOGGING
data, but to transmit only TransportType.LOGGING
data. For TransportType.EVENT
data transmission will be used
ChannelB instance.removeChannel(KaaDataChannel)
DefaultBootstrapChannel
, DefaultOperationsChannel
and
DefaultOperationHttpChannel
(in given order).removeChannel(KaaDataChannel)
forces KaaChannelManager to
remove given channel and reset TransportType-to-Channel internal mapping with
applicable channel if such exists.clearChannelList()
removes all existing channels.onServerFailed(TransportConnectionInfo)
to switch to another available server.KaaDataChannel
Modifier and Type | Method and Description |
---|---|
void |
addChannel(KaaDataChannel channel)
Updates the manager by adding the channel.
|
void |
clearChannelList()
Clears the list of channels.
|
KaaDataChannel |
getChannel(String id)
Retrieves channel by the unique channel id.
|
KaaDataChannel |
getChannelByTransportType(org.kaaproject.kaa.common.TransportType type)
Retrieves a list of channels by the specific transport type.
|
List<KaaDataChannel> |
getChannels()
Retrieves the list of current channels.
|
void |
onServerFailed(TransportConnectionInfo server)
Reports to Channel Manager in case link with server was not established.
|
void |
onTransportConnectionInfoUpdated(TransportConnectionInfo newServer)
Reports to Channel Manager about the new server.
|
void |
pause()
Pauses all active channels.
|
void |
removeChannel(KaaDataChannel channel)
Updates the manager by removing the channel from the manager.
|
void |
removeChannel(String id)
Updates the manager by removing the channel from the manager.
|
void |
resume()
Restores channels' activity.
|
void |
setChannel(org.kaaproject.kaa.common.TransportType transport,
KaaDataChannel channel)
Updates the manager by setting the channel to the specified
TransportType . |
void |
setConnectivityChecker(ConnectivityChecker checker)
Sets connectivity checker to the existing channels.
|
void |
shutdown()
Shuts down the manager and all registered channels.
|
void setChannel(org.kaaproject.kaa.common.TransportType transport, KaaDataChannel channel) throws KaaInvalidChannelException
TransportType
.transport
- the type of the transport which is going to receive updates using the specified channel.channel
- the channel to be added.KaaInvalidChannelException
KaaDataChannel
void addChannel(KaaDataChannel channel)
channel
- the channel to be added.KaaDataChannel
void removeChannel(KaaDataChannel channel)
channel
- the channel to be removed.KaaDataChannel
void removeChannel(String id)
id
- the channel's id.KaaDataChannel
List<KaaDataChannel> getChannels()
KaaDataChannel
KaaDataChannel getChannelByTransportType(org.kaaproject.kaa.common.TransportType type)
type
- the transport's type.TransportType
,
KaaDataChannel
KaaDataChannel getChannel(String id)
id
- the channel's id.KaaDataChannel
void onServerFailed(TransportConnectionInfo server)
server
- the parameters of server that was not connected.TransportConnectionInfo
void onTransportConnectionInfoUpdated(TransportConnectionInfo newServer)
newServer
- the parameters of the new server.TransportConnectionInfo
void clearChannelList()
void setConnectivityChecker(ConnectivityChecker checker)
checker
- platform-dependent connectivity checker.ConnectivityChecker
void shutdown()
void pause()
void resume()
Copyright © 2015. All rights reserved.