• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java KNXNetworkLinkIP类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中tuwien.auto.calimero.link.KNXNetworkLinkIP的典型用法代码示例。如果您正苦于以下问题:Java KNXNetworkLinkIP类的具体用法?Java KNXNetworkLinkIP怎么用?Java KNXNetworkLinkIP使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



KNXNetworkLinkIP类属于tuwien.auto.calimero.link包,在下文中一共展示了KNXNetworkLinkIP类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: isLoopbackMode

import tuwien.auto.calimero.link.KNXNetworkLinkIP; //导入依赖的package包/类
/**
 * 
 * @return true, if loopbackmode, false if no loopback-mode or no information about loopback available/accessible
 */
public boolean isLoopbackMode() {
    try {
        Field connField = KNXNetworkLinkIP.class.getDeclaredField("conn");
        connField.setAccessible(true);
        
        KNXnetIPConnection conn = (KNXnetIPConnection) connField.get(this);
        
        if (conn instanceof KNXnetIPRouting) {
            KNXnetIPRouting knxnetiprouting = (KNXnetIPRouting) conn;
            
            
            return knxnetiprouting.usesMulticastLoopback();
        }
                
    } catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException ex) {
        ex.printStackTrace();
    }
    return false;
}
 
开发者ID:tuxedo0801,项目名称:slicKnx,代码行数:24,代码来源:SlicKNXNetworkLinkIP.java


示例2: connectByIp

import tuwien.auto.calimero.link.KNXNetworkLinkIP; //导入依赖的package包/类
private static KNXNetworkLink connectByIp(int ipConnectionType, String localIp, String ip, int port) throws KNXException, UnknownHostException, InterruptedException {

		InetSocketAddress localEndPoint = null;
		if (StringUtils.isNotBlank(localIp)) {
			localEndPoint = new InetSocketAddress(localIp, 0);
		} else {
			try {
				InetAddress localHost = InetAddress.getLocalHost();
				localEndPoint = new InetSocketAddress(localHost, 0);
			} catch (UnknownHostException uhe) {
				sLogger.warn("Couldn't find an IP address for this host. Please check the .hosts configuration or use the 'localIp' parameter to configure a valid IP address.");
			}
		}
		
		return new KNXNetworkLinkIP(ipConnectionType, localEndPoint, new InetSocketAddress(ip, port), false, new TPSettings(new IndividualAddress(sLocalSourceAddr), true));
	}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:17,代码来源:KNXConnection.java


示例3: createLink

import tuwien.auto.calimero.link.KNXNetworkLinkIP; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:gskbyte,项目名称:kora,代码行数:32,代码来源:ProcComm.java


示例4: connectByIp

import tuwien.auto.calimero.link.KNXNetworkLinkIP; //导入依赖的package包/类
private static KNXNetworkLink connectByIp(int ipConnectionType, String localIp, String ip, int port)
        throws KNXException, UnknownHostException, InterruptedException {

    InetSocketAddress localEndPoint = null;
    if (StringUtils.isNotBlank(localIp)) {
        localEndPoint = new InetSocketAddress(localIp, 0);
    } else {
        try {
            InetAddress localHost = InetAddress.getLocalHost();
            localEndPoint = new InetSocketAddress(localHost, 0);
        } catch (UnknownHostException uhe) {
            sLogger.warn(
                    "Couldn't find an IP address for this host. Please check the .hosts configuration or use the 'localIp' parameter to configure a valid IP address.");
        }
    }

    return new KNXNetworkLinkIP(ipConnectionType, localEndPoint, new InetSocketAddress(ip, port), sUseNAT,
            new TPSettings(new IndividualAddress(sLocalSourceAddr), true));
}
 
开发者ID:openhab,项目名称:openhab1-addons,代码行数:20,代码来源:KNXConnection.java


示例5: createLink

import tuwien.auto.calimero.link.KNXNetworkLinkIP; //导入依赖的package包/类
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;
}
 
开发者ID:ow2-chameleon,项目名称:fuchsia,代码行数:20,代码来源:KNXLinkManager.java


示例6: setLoopbackMode

import tuwien.auto.calimero.link.KNXNetworkLinkIP; //导入依赖的package包/类
/**
     * 
     * @param flag true to enable loopback, fals to disable loopback
     */
    public void setLoopbackMode(boolean flag) {
        try {
            Field connField = KNXNetworkLinkIP.class.getDeclaredField("conn");
            connField.setAccessible(true);
            
//            KNXnetIPConnection conn = (KNXnetIPConnection) connField.get(this);
            KNXnetIPRouting conn = (KNXnetIPRouting) connField.get(this);
            
            if (conn instanceof KNXnetIPRouting) {
                KNXnetIPRouting knxnetiprouting = (KNXnetIPRouting) conn;
                
                Field socketField = KNXnetIPRouting.class.getSuperclass().getDeclaredField("socket");
                socketField.setAccessible(true);
                MulticastSocket socket = (MulticastSocket) socketField.get(knxnetiprouting);
                socket.setLoopbackMode(!flag); // weird inverse logic, see javadoc of MulticastSocket#setLoopbackMode
                
                Field loopbackEnabledField = KNXnetIPRouting.class.getDeclaredField("loopbackEnabled");
                loopbackEnabledField.setAccessible(true);
                loopbackEnabledField.set(knxnetiprouting, !socket.getLoopbackMode());
                Boolean loopbackEnabled = (Boolean) loopbackEnabledField.get(knxnetiprouting);
                logger.info("multicast loopback mode " + (loopbackEnabled ? "enabled" : "disabled"));
                
            }
                    
        } catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException | SocketException ex) {
            ex.printStackTrace();
        }
    }
 
开发者ID:tuxedo0801,项目名称:slicKnx,代码行数:33,代码来源:SlicKNXNetworkLinkIP.java


示例7: Knx

import tuwien.auto.calimero.link.KNXNetworkLinkIP; //导入依赖的package包/类
/**
 * UNTESTED!!!! Start KNX communication with with TUNNELING mode
 *
 * @param host
 * @throws KnxException
 */
public Knx(InetAddress host) throws KnxException {
    try {

        // setup knx tunneling onnection
        netlink = new KNXNetworkLinkIP(host.getHostAddress(), new TPSettings());

        pc = new SlicKnxProcessCommunicatorImpl(netlink);
        log.debug("Connected to knx via {}:{} and individualaddress {}", hostadr, port, individualAddress);
        pc.addProcessListener(ggal);
    } catch (KNXException | InterruptedException ex) {
        throw new KnxException("Error connecting to KNX: " + ex.getMessage(), ex);
    }
}
 
开发者ID:tuxedo0801,项目名称:slicKnx,代码行数:20,代码来源:Knx.java


示例8: openConnection

import tuwien.auto.calimero.link.KNXNetworkLinkIP; //导入依赖的package包/类
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);
}
 
开发者ID:heia-fr,项目名称:wot_gateways,代码行数:8,代码来源:KNXComm.java



注:本文中的tuwien.auto.calimero.link.KNXNetworkLinkIP类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java QualityQueryParser类代码示例发布时间:2022-05-22
下一篇:
Java JsonGenerator类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap