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

Java KNXNetworkLink类代码示例

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

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



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

示例1: detach

import tuwien.auto.calimero.link.KNXNetworkLink; //导入依赖的package包/类
@Override
public KNXNetworkLink detach() {
    // if we synchronize on method we would take into account
    // a worst case blocking of response timeout seconds
    synchronized (lnkListener) {
        // wait of response time seconds
        if (detached) {
            return null;
        }
        detached = true;
    }
    lnk.removeLinkListener(lnkListener);
    fireDetached();
    logger.info("detached from " + lnk.getName());
    LogManager.getManager().removeLogService(logger.getName());
    return lnk;
}
 
开发者ID:tuxedo0801,项目名称:slicKnx,代码行数:18,代码来源:SlicKnxProcessCommunicatorImpl.java


示例2: connectByIp

import tuwien.auto.calimero.link.KNXNetworkLink; //导入依赖的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: run

import tuwien.auto.calimero.link.KNXNetworkLink; //导入依赖的package包/类
/**
 * Runs the process communicator.
 * <p>
 * This method immediately returns when the process communicator is running. Call
 * {@link #quit()} to quit process communication.
 *
 * @param l a process event listener, can be <code>null</code>
 * @throws KNXException on problems creating network link or communication
 */
public void run(ProcessListener l) throws KNXException
{
	// create the network link to the KNX network
	final KNXNetworkLink lnk = createLink();
	LogManager.getManager().addWriter(lnk.getName(), w);
	// create process communicator with the established link
	pc = new ProcessCommunicatorImpl(lnk);
	if (l != null)
		pc.addProcessListener(l);
	registerShutdownHandler();
	// user might specify a response timeout for KNX message
	// answers from the KNX network
	if (options.containsKey("timeout"))
		pc.setResponseTimeout(((Integer) options.get("timeout")).intValue());
}
 
开发者ID:gskbyte,项目名称:kora,代码行数:25,代码来源:ProcComm.java


示例4: createLink

import tuwien.auto.calimero.link.KNXNetworkLink; //导入依赖的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


示例5: connectByIp

import tuwien.auto.calimero.link.KNXNetworkLink; //导入依赖的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


示例6: detach

import tuwien.auto.calimero.link.KNXNetworkLink; //导入依赖的package包/类
public KNXNetworkLink detach()
{
	// if we synchronize on method we would take into account
	// a worst case blocking of response timeout seconds
	synchronized (lnkListener) {
		// wait of response time seconds
		if (detached)
			return null;
		detached = true;
	}
	lnk.removeLinkListener(lnkListener);
	fireDetached();
	logger.info("detached from " + lnk.getName());
	LogManager.getManager().removeLogService(logger.getName());
	return lnk;
}
 
开发者ID:ow2-chameleon,项目名称:fuchsia,代码行数:17,代码来源:ProcessCommunicatorImpl.java


示例7: getLink

import tuwien.auto.calimero.link.KNXNetworkLink; //导入依赖的package包/类
public KNXNetworkLink getLink(String local,String gateway){

        KNXLink link=new KNXLink(local,gateway);

        if(linkPool.get(link)==null){
            try {
                linkPool.put(link,createLink(local, gateway));
            } catch (KNXException e) {
                e.printStackTrace();
                LOG.error("KNX: Failed to create link from inet local {} to {}",local,gateway);
            }
        }

        KNXNetworkLink knxLink=linkPool.get(link);

        return knxLink;

    }
 
开发者ID:ow2-chameleon,项目名称:fuchsia,代码行数:19,代码来源:KNXLinkManager.java


示例8: createLink

import tuwien.auto.calimero.link.KNXNetworkLink; //导入依赖的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


示例9: dispose

import tuwien.auto.calimero.link.KNXNetworkLink; //导入依赖的package包/类
/**
 * Disposes KNX Gateway Driver allocated resources, such as pooled network links.
 */
public static void dispose() {
    try {
        for (KNXNetworkLink link : connectionPool.values()) {
            link.close();
        }
    } catch (Exception e) {
        logger.error("Exception occurred while disposing KNX network link.", e);
    }
}
 
开发者ID:jpinho,项目名称:soaba,代码行数:13,代码来源:KNXGatewayDriver.java


示例10: disconnect

import tuwien.auto.calimero.link.KNXNetworkLink; //导入依赖的package包/类
public static synchronized void disconnect() {
	sShutdown = true;
	if (sPC!=null) {
		KNXNetworkLink link = sPC.detach();
		if(sProcessCommunicationListener!=null) {
			sPC.removeProcessListener(sProcessCommunicationListener);
			sProcessCommunicationListener = null;
		}
		if (link!=null) {
			sLogger.info("Closing KNX connection");
			link.close();
		}
	}
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:15,代码来源:KNXConnection.java


示例11: quit

import tuwien.auto.calimero.link.KNXNetworkLink; //导入依赖的package包/类
/**
 * Quits process communication.
 * <p>
 * Detaches the network link from the process communicator and closes the link.
 */
public void quit()
{
	if (pc != null) {
		final KNXNetworkLink lnk = pc.detach();
		if (lnk != null)
			lnk.close();
		Runtime.getRuntime().removeShutdownHook(sh);
	}
}
 
开发者ID:gskbyte,项目名称:kora,代码行数:15,代码来源:ProcComm.java


示例12: disconnect

import tuwien.auto.calimero.link.KNXNetworkLink; //导入依赖的package包/类
public static synchronized void disconnect() {
    sShutdown = true;
    if (sPC != null) {
        KNXNetworkLink link = sPC.detach();
        if (sProcessCommunicationListener != null) {
            sPC.removeProcessListener(sProcessCommunicationListener);
            sProcessCommunicationListener = null;
        }
        if (link != null) {
            sLogger.info("Closing KNX connection");
            link.close();
        }
    }
}
 
开发者ID:openhab,项目名称:openhab1-addons,代码行数:15,代码来源:KNXConnection.java


示例13: detach

import tuwien.auto.calimero.link.KNXNetworkLink; //导入依赖的package包/类
public KNXNetworkLink detach()
{
	final KNXNetworkLink lnk = tl.detach();
	if (lnk != null) {
		logger.info("detached from " + lnk.getName());
		LogManager.getManager().removeLogService(logger.getName());
	}
	detached = true;
	return lnk;
}
 
开发者ID:ow2-chameleon,项目名称:fuchsia,代码行数:11,代码来源:ManagementClientImpl.java


示例14: RemotePropertyServiceAdapter

import tuwien.auto.calimero.link.KNXNetworkLink; //导入依赖的package包/类
/**
 * Creates a new property adapter for remote property access.
 * 
 * @param link KNX network link used for communication with the KNX network
 * @param remote KNX individual address to access its interface objects
 * @param l property adapter listener to get notified about adapter events, use
 *        <code>null</code> for no listener
 * @param connOriented <code>true</code> to use connection oriented mode for access,
 *        <code>false</code> to use connectionless mode
 * @throws KNXLinkClosedException if the network link is closed
 */
public RemotePropertyServiceAdapter(KNXNetworkLink link, IndividualAddress remote,
	PropertyAdapterListener l, boolean connOriented) throws KNXLinkClosedException
{
	mc = new ManagementClientImpl(link);
	dst = mc.createDestination(remote, connOriented);
	pal = l;
	nll = pal != null ? new NLListener() : null;
	if (nll != null)
		link.addLinkListener(nll);
	key = null;
}
 
开发者ID:ow2-chameleon,项目名称:fuchsia,代码行数:23,代码来源:RemotePropertyServiceAdapter.java


示例15: TransportLayerImpl

import tuwien.auto.calimero.link.KNXNetworkLink; //导入依赖的package包/类
/**
 * Creates a new transport layer attached to the supplied KNX network link.
 * <p>
 * 
 * @param link network link used for communication with a KNX network
 * @throws KNXLinkClosedException if the network link is closed
 */
public TransportLayerImpl(KNXNetworkLink link) throws KNXLinkClosedException
{
	if (!link.isOpen())
		throw new KNXLinkClosedException();
	lnk = link;
	lnk.addLinkListener(lnkListener);
	logger = LogManager.getManager().getLogService(getName());
	listeners = new EventListeners(logger);
}
 
开发者ID:ow2-chameleon,项目名称:fuchsia,代码行数:17,代码来源:TransportLayerImpl.java


示例16: detach

import tuwien.auto.calimero.link.KNXNetworkLink; //导入依赖的package包/类
public synchronized KNXNetworkLink detach()
{
	if (detached)
		return null;
	closeDestinations(false);
	lnk.removeLinkListener(lnkListener);
	detached = true;
	fireDetached();
	logger.info("detached from " + lnk.getName());
	LogManager.getManager().removeLogService(logger.getName());
	return lnk;
}
 
开发者ID:ow2-chameleon,项目名称:fuchsia,代码行数:13,代码来源:TransportLayerImpl.java


示例17: ProcessCommunicatorImpl

import tuwien.auto.calimero.link.KNXNetworkLink; //导入依赖的package包/类
/**
 * Creates a new process communicator attached to the supplied KNX network link.
 * <p>
 * The log service used by this process communicator is named "process " +
 * <code>link.getName()</code>.
 * 
 * @param link network link used for communication with a KNX network
 * @throws KNXLinkClosedException if the network link is closed
 */
public ProcessCommunicatorImpl(KNXNetworkLink link) throws KNXLinkClosedException
{
	if (!link.isOpen())
		throw new KNXLinkClosedException();
	lnk = link;
	lnk.addLinkListener(lnkListener);
	logger = LogManager.getManager().getLogService("process " + link.getName());
	listeners = new EventListeners(logger);
}
 
开发者ID:ow2-chameleon,项目名称:fuchsia,代码行数:19,代码来源:ProcessCommunicatorImpl.java


示例18: getConfiguration

import tuwien.auto.calimero.link.KNXNetworkLink; //导入依赖的package包/类
/**
 * Gets the configuration which provides the buffered link.
 * <p>
 * If the network link is not a buffered link or not found in the current
 * configurations of this network buffer, <code>null</code> is returned.
 * 
 * @param bufferedLink the buffered link to get the configuration for
 * @return the owning configuration of that link or <code>null</code>
 */
public Configuration getConfiguration(KNXNetworkLink bufferedLink)
{
	synchronized (configs) {
		for (final Iterator i = configs.iterator(); i.hasNext();) {
			final ConfigImpl lc = (ConfigImpl) i.next();
			if (lc.getBufferedLink() == bufferedLink)
				return lc;
		}
	}
	return null;
}
 
开发者ID:ow2-chameleon,项目名称:fuchsia,代码行数:21,代码来源:NetworkBuffer.java


示例19: disconnect

import tuwien.auto.calimero.link.KNXNetworkLink; //导入依赖的package包/类
public void disconnect(){

        for(Map.Entry<KNXLink,KNXNetworkLink> entry:linkPool.entrySet()){
            LOG.info("Disconnecting from {}",entry.getKey().getGateway());
            entry.getValue().close();
            LOG.info("Disconnected from {}",entry.getKey().getGateway());
        }

    }
 
开发者ID:ow2-chameleon,项目名称:fuchsia,代码行数:10,代码来源:KNXLinkManager.java


示例20: getNetworkLink

import tuwien.auto.calimero.link.KNXNetworkLink; //导入依赖的package包/类
public KNXNetworkLink getNetworkLink() {
    return knxLink;
}
 
开发者ID:jpinho,项目名称:soaba,代码行数:4,代码来源:KNXGatewayDriver.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java FailureHandler类代码示例发布时间:2022-05-22
下一篇:
Java RowAction类代码示例发布时间: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