本文整理汇总了Java中tuwien.auto.calimero.link.KNXNetworkLinkIP.TUNNEL属性的典型用法代码示例。如果您正苦于以下问题:Java KNXNetworkLinkIP.TUNNEL属性的具体用法?Java KNXNetworkLinkIP.TUNNEL怎么用?Java KNXNetworkLinkIP.TUNNEL使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类tuwien.auto.calimero.link.KNXNetworkLinkIP
的用法示例。
在下文中一共展示了KNXNetworkLinkIP.TUNNEL属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createLink
/**
* Creates the KNX network link to access the network specified in
* <code>options</code>.
* <p>
*
* @return the KNX network link
* @throws KNXException on problems on link creation
*/
private KNXNetworkLink createLink() throws KNXException
{
final KNXMediumSettings medium = (KNXMediumSettings) options.get("medium");
if (options.containsKey("serial")) {
// create FT1.2 network link
final String p = (String) options.get("serial");
try {
return new KNXNetworkLinkFT12(Integer.parseInt(p), medium);
}
catch (final NumberFormatException e) {
return new KNXNetworkLinkFT12(p, medium);
}
}
// create local and remote socket address for network link
final InetSocketAddress local = createLocalSocket((InetAddress)
options.get("localhost"), (Integer) options.get("localport"));
final InetSocketAddress host = new InetSocketAddress((InetAddress)
options.get("host"), ((Integer) options.get("port")).intValue());
final int mode = options.containsKey("routing") ? KNXNetworkLinkIP.ROUTER
: KNXNetworkLinkIP.TUNNEL;
return new KNXNetworkLinkIP(mode, local, host, options.containsKey("nat"),
medium);
}
示例2: createLink
private KNXNetworkLink createLink(String localhostIface,String gatewayIface) throws KNXException {
try {
InetAddress localhost = InetAddress.getByName(localhostIface);
InetAddress gatewayHost = InetAddress.getByName(gatewayIface);
final InetSocketAddress local = createLocalSocket(localhost, null);
final InetSocketAddress host = new InetSocketAddress(gatewayHost,
KNXnetIPConnection.IP_PORT);
final int mode = KNXNetworkLinkIP.TUNNEL;
LOG.info("Mode {} local {} host {}",new Object[]{mode,local,host});
return new KNXNetworkLinkIP(mode, local, host, false,
TPSettings.TP1);
} catch (UnknownHostException e) {
e.printStackTrace();
}
return null;
}
示例3: openConnection
private void openConnection() throws SocketException, KNXException {
m_link = new KNXNetworkLinkIP(KNXNetworkLinkIP.TUNNEL,
new InetSocketAddress(getIPAddr(), 6378),
new InetSocketAddress(m_GatewayIP, 3671), false, m_settings);
m_comm = new ProcessCommunicatorImpl(m_link);
m_comm.addProcessListener(this);
}