public class CapabilityTunnel extends Capability
Modifier and Type | Class and Description |
---|---|
static class |
CapabilityTunnel.AttributeId
enum denoting various possible attributes of the
CapabilityTunnel . |
static class |
CapabilityTunnel.CommandId
enum denoting the possible Commands that can be sent for
CapabilityTunnel . |
static class |
CapabilityTunnel.IpVersion
enum denoting possible values for Ip version.
|
static class |
CapabilityTunnel.Protocol
enum denoting possible values for tunnel protocol.
|
static class |
CapabilityTunnel.State
enum denoting possible values for tunnel state.
|
static class |
CapabilityTunnel.TransportType
enum denoting possible values for type of transport.
|
static interface |
CapabilityTunnel.TunnelStatusListener
Listener which will be triggered after the callback.
|
static class |
CapabilityTunnel.TunnelType
enum denoting possible values for type of tunnel.
|
Capability.CapabilityId, Capability.CommandStatusListener<T extends Capability.CommandId>
Modifier and Type | Field and Description |
---|---|
static Capability.CapabilityId |
ID |
Modifier | Constructor and Description |
---|---|
protected |
CapabilityTunnel(int id,
Resource parent)
Constructor of the current class.
|
Modifier and Type | Method and Description |
---|---|
void |
close(long tunnelHandle,
long timeout)
This function is used to close the existing tunnel present of this capability.
|
void |
closeAllTunnels(long timeout)
A function used to close an existing tunnel.
|
protected Command<? extends Capability.CommandId> |
extendedCreateCommand(int primitiveCommandId,
com.google.gson.JsonElement commandParams)
A function to create the command from the Json params.
|
int |
getPort(long tunnelHandle)
This function is used to get the port over which the tunnel is open.
|
CapabilityTunnel.State |
getState(long tunnelHandle)
This function is used to get The state of the tunnel which is
represented by the enum State.
|
protected java.util.Map<java.lang.Long,buzz.getcoco.iot.CapabilityTunnel.StatePort> |
getTunnelHandleMap() |
void |
open(java.lang.String forwardHostName,
int forwardHostPort,
java.lang.String listeningHostName,
int listeningHostPort,
CapabilityTunnel.TransportType transportType,
CapabilityTunnel.TunnelType tunnelType,
CapabilityTunnel.Protocol protocol,
CapabilityTunnel.IpVersion ipVersion,
long timeout,
CapabilityTunnel.TunnelStatusListener listener)
This function is used to open Tunnel.
|
void |
openTcpTunnel(java.lang.String listeningHostName,
int listeningHostPort,
CapabilityTunnel.TunnelType tunnelType,
CapabilityTunnel.IpVersion ipVersion,
long timeout,
CapabilityTunnel.TunnelStatusListener listener)
A function to open TCP tunnel (simple wrap of
open(java.lang.String, int, java.lang.String, int, buzz.getcoco.iot.CapabilityTunnel.TransportType, buzz.getcoco.iot.CapabilityTunnel.TunnelType, buzz.getcoco.iot.CapabilityTunnel.Protocol, buzz.getcoco.iot.CapabilityTunnel.IpVersion, long, buzz.getcoco.iot.CapabilityTunnel.TunnelStatusListener) ). |
void |
openUdpTunnel(java.lang.String forwardHostName,
int forwardHostPort,
CapabilityTunnel.TunnelType tunnelType,
CapabilityTunnel.IpVersion ipVersion,
long timeout,
CapabilityTunnel.TunnelStatusListener listener)
A function to open UDP tunnel (simple wrap of
open(java.lang.String, int, java.lang.String, int, buzz.getcoco.iot.CapabilityTunnel.TransportType, buzz.getcoco.iot.CapabilityTunnel.TunnelType, buzz.getcoco.iot.CapabilityTunnel.Protocol, buzz.getcoco.iot.CapabilityTunnel.IpVersion, long, buzz.getcoco.iot.CapabilityTunnel.TunnelStatusListener) ). |
boolean |
supports(Capability.CommandId commandId)
This function checks if a command is supported or not, pass
null to check if capability supports any commands at all.
|
clearAndSetStandardCommandSet, containsAttribute, containsAttribute, createCommand, createCommandResponseArgs, getAttribute, getAttribute, getAttributeMap, getCapabilityWrapper, getId, getName, getParent, getSupportedCommands, hashCode, interceptCommand, internalAddAttribute, internalMarkAsReady, internalRemoveAttribute, internalSetName, internalSetParent, isReady, iterator, sendResourceCommand, setCapabilityWrapper, toString
public static final Capability.CapabilityId ID
protected CapabilityTunnel(int id, Resource parent)
id
- The unique id Of the capabilityparent
- The parent Resource of the capability.public boolean supports(Capability.CommandId commandId)
Capability
supports
in class Capability
commandId
- The Id denoting the command to be sent.public void openUdpTunnel(java.lang.String forwardHostName, int forwardHostPort, CapabilityTunnel.TunnelType tunnelType, CapabilityTunnel.IpVersion ipVersion, long timeout, CapabilityTunnel.TunnelStatusListener listener)
open(java.lang.String, int, java.lang.String, int, buzz.getcoco.iot.CapabilityTunnel.TransportType, buzz.getcoco.iot.CapabilityTunnel.TunnelType, buzz.getcoco.iot.CapabilityTunnel.Protocol, buzz.getcoco.iot.CapabilityTunnel.IpVersion, long, buzz.getcoco.iot.CapabilityTunnel.TunnelStatusListener)
).forwardHostName
- The hostname which will receive the dataforwardHostPort
- The port over which data will be receivedtunnelType
- The type of the tunnel (LISTEN/CONNECT)ipVersion
- The ipVersion used for identification (ipV4/ipV6)timeout
- The timeout for this command in millislistener
- The listener which will be triggered after the callback This will be
useful in tracking in tunnelStatusCbspublic void openTcpTunnel(java.lang.String listeningHostName, int listeningHostPort, CapabilityTunnel.TunnelType tunnelType, CapabilityTunnel.IpVersion ipVersion, long timeout, CapabilityTunnel.TunnelStatusListener listener)
open(java.lang.String, int, java.lang.String, int, buzz.getcoco.iot.CapabilityTunnel.TransportType, buzz.getcoco.iot.CapabilityTunnel.TunnelType, buzz.getcoco.iot.CapabilityTunnel.Protocol, buzz.getcoco.iot.CapabilityTunnel.IpVersion, long, buzz.getcoco.iot.CapabilityTunnel.TunnelStatusListener)
).listeningHostName
- The hostname of the transmitting devicelisteningHostPort
- The port over which the device will transmit datatunnelType
- The type of the tunnel (LISTEN/CONNECT)ipVersion
- The ipVersion used for identification (ipV4/ipV6)timeout
- The timeout for this command in millislistener
- The listener which will be triggered after the callback. This will be
useful in tracking in tunnelStatusCbspublic void open(java.lang.String forwardHostName, int forwardHostPort, java.lang.String listeningHostName, int listeningHostPort, CapabilityTunnel.TransportType transportType, CapabilityTunnel.TunnelType tunnelType, CapabilityTunnel.Protocol protocol, CapabilityTunnel.IpVersion ipVersion, long timeout, CapabilityTunnel.TunnelStatusListener listener)
forwardHostName
- The hostname which will receive the dataforwardHostPort
- The port over which data will be receivedlisteningHostName
- The hostname of the transmitting devicelisteningHostPort
- The port over which the device will transmit datatransportType
- The TransportType (TCP/UDP) on which the transmission shall take placetunnelType
- The type of the tunnel (LISTEN/CONNECT)protocol
- The protocol of the transmission (RTSP)ipVersion
- The ipVersion used for identification (ipV4/ipV6)timeout
- The timeout for this command in millislistener
- The listener which will be triggered after the callback. This will be
useful in tracking in tunnelStatusCbspublic void closeAllTunnels(long timeout)
timeout
- timeout defined for the operationpublic void close(long tunnelHandle, long timeout)
java.lang.RuntimeException
- on failure to close the tunnel.public int getPort(long tunnelHandle)
public CapabilityTunnel.State getState(long tunnelHandle)
protected Command<? extends Capability.CommandId> extendedCreateCommand(int primitiveCommandId, com.google.gson.JsonElement commandParams)
extendedCreateCommand
in class Capability
primitiveCommandId
- The int form of the commandIdcommandParams
- The Json params that can form a commandprotected java.util.Map<java.lang.Long,buzz.getcoco.iot.CapabilityTunnel.StatePort> getTunnelHandleMap()