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

Java TPSettings类代码示例

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

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



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

示例1: Knx

import tuwien.auto.calimero.link.medium.TPSettings; //导入依赖的package包/类
/**
     * Start KNX communication via serial connection
     *
     * @param type according to your serial connection type
     * @param device device, like "/dev/ttyUSB0" or "COM10"
     * @throws KnxException in case of any problem
     */
    public Knx(SerialType type, String device) throws KnxException {
        try {
            switch (type) {
                case TPUART:
                    netlink = new KNXNetworkLinkTpuart(device, new TPSettings(), new ArrayList());
                    break;
                case FT12:
                case UNDEFINED:
                    log.error("SerialType [{}] not yet supported", type);
                    throw new KnxException("SerialType [" + type + "] not yet supported");
            }
            // setup knx connection
//            netlink = new SlicKNXNetworkLinkIP(KNXNetworkLinkIP.TUNNELING, null, new InetSocketAddress(host, port), false, new TPSettings(false));

            pc = new SlicKnxProcessCommunicatorImpl(netlink);
            log.debug("Connected to knx via {}:{} and individualaddress {}", hostadr, port, individualAddress);
            pc.addProcessListener(ggal);
        } catch (KNXException ex) {
            throw new KnxException("error creating serial link for type [" + type + "]", ex);
        }
    }
 
开发者ID:tuxedo0801,项目名称:slicKnx,代码行数:29,代码来源:Knx.java


示例2: connectByIp

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

import tuwien.auto.calimero.link.medium.TPSettings; //导入依赖的package包/类
/**
 * Creates a medium settings type for the supplied medium identifier.
 * <p>
 *
 * @param id a medium identifier from command line option
 * @return medium settings object
 * @throws KNXIllegalArgumentException on unknown medium identifier
 */
private static KNXMediumSettings getMedium(String id)
{
	if (id.equals("tp0"))
		return TPSettings.TP0;
	else if (id.equals("tp1"))
		return TPSettings.TP1;
	else if (id.equals("p110"))
		return new PLSettings(false);
	else if (id.equals("p132"))
		return new PLSettings(true);
	else if (id.equals("rf"))
		return new RFSettings(null);
	else
		throw new KNXIllegalArgumentException("unknown medium");
}
 
开发者ID:gskbyte,项目名称:kora,代码行数:24,代码来源:ProcComm.java


示例4: connectByIp

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

import tuwien.auto.calimero.link.medium.TPSettings; //导入依赖的package包/类
private static KNXMediumSettings getMedium(String id)
{
	// for now, the local device address is always left 0 in the
	// created medium setting, since there is no user cmd line option for this
	// so KNXnet/IP server will supply address
	if (id.equals("tp0"))
		return TPSettings.TP0;
	else if (id.equals("tp1"))
		return TPSettings.TP1;
	else if (id.equals("p110"))
		return new PLSettings(false);
	else if (id.equals("p132"))
		return new PLSettings(true);
	else if (id.equals("rf"))
		return new RFSettings(null);
	else
		throw new KNXIllegalArgumentException("unknown medium");
}
 
开发者ID:ow2-chameleon,项目名称:fuchsia,代码行数:19,代码来源:PropClient.java


示例6: createLink

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


示例7: adjustMsgType

import tuwien.auto.calimero.link.medium.TPSettings; //导入依赖的package包/类
private CEMILData adjustMsgType(CEMILData msg)
{
	final boolean srcOk = msg.getSource().getRawAddress() != 0;
	// just return if we don't need to adjust source address and don't need LDataEx
	if ((srcOk || medium.getDeviceAddress().getRawAddress() == 0)
		&& (medium instanceof TPSettings || msg instanceof CEMILDataEx))
		return msg;
	return (CEMILDataEx) CEMIFactory.create(srcOk ? null : medium.getDeviceAddress(),
		null, msg, true);
}
 
开发者ID:ow2-chameleon,项目名称:fuchsia,代码行数:11,代码来源:KNXNetworkLinkIP.java


示例8: parseOptions

import tuwien.auto.calimero.link.medium.TPSettings; //导入依赖的package包/类
private static boolean parseOptions(String[] args, Map options)
	throws KNXFormatException
{
	if (args.length == 0) {
		System.out.println("A tool for KNX property access");
		showVersion();
		System.out.println("type -help for help message");
		return false;
	}
	// add defaults
	options.put("port", new Integer(KNXnetIPConnection.IP_PORT));
	options.put("medium", TPSettings.TP1);

	int i = 0;
	for (; i < args.length; i++) {
		final String arg = args[i];
		if (isOption(arg, "-help", "-h")) {
			showUsage();
			return false;
		}
		if (isOption(arg, "-version", null)) {
			showVersion();
			return false;
		}
		if (isOption(arg, "-local", "-l"))
			options.put("localDM", null);
		else if (isOption(arg, "-remote", "-r"))
			options.put("remote", new IndividualAddress(args[++i]));
		else if (isOption(arg, "-definitions", "-d"))
			options.put("defs", args[++i]);
		else if (isOption(arg, "-verbose", "-v"))
			options.put("verbose", null);
		else if (isOption(arg, "-localhost", null))
			parseHost(args[++i], true, options);
		else if (isOption(arg, "-localport", null))
			options.put("localport", Integer.decode(args[++i]));
		else if (isOption(arg, "-port", "-p"))
			options.put("port", Integer.decode(args[++i]));
		else if (isOption(arg, "-nat", "-n"))
			options.put("nat", null);
		else if (isOption(arg, "-serial", "-s"))
			options.put("serial", null);
		else if (isOption(arg, "-medium", "-m"))
			options.put("medium", getMedium(args[++i]));
		else if (isOption(arg, "-emulatewriteenable", "-e"))
			options.put("emulatewrite", null);
		else if (isOption(arg, "-connect", "-c"))
			options.put("connect", null);
		else if (isOption(arg, "-authorize", "-a"))
			options.put("authorize", getAuthorizeKey(args[++i]));
		else if (isOption(arg, "-routing", null))
			options.put("routing", null);
		else if (options.containsKey("serial"))
			// add port number/identifier to serial option
			options.put("serial", arg);
		else if (!options.containsKey("host"))
			parseHost(arg, false, options);
		else
			throw new IllegalArgumentException("unknown option " + arg);
	}
	if (!options.containsKey("localDM") && !options.containsKey("remote"))
		throw new IllegalArgumentException("no connection category specified");
	if (!options.containsKey("host") && !options.containsKey("serial"))
		throw new IllegalArgumentException("no host or serial port specified");
	if (options.containsKey("serial") && !options.containsKey("remote"))
		throw new IllegalArgumentException("-remote option is mandatory with -serial");
	return true;
}
 
开发者ID:ow2-chameleon,项目名称:fuchsia,代码行数:69,代码来源:PropClient.java


示例9: parseOptions

import tuwien.auto.calimero.link.medium.TPSettings; //导入依赖的package包/类
private static boolean parseOptions(String[] args, Map options)
	throws KNXFormatException
{
	if (args.length == 0) {
		System.out.println("A tool for KNXnet/IP address configuration");
		showVersion();
		System.out.println("type -help for help message");
		return false;
	}
	// add defaults
	options.put("port", new Integer(KNXnetIPConnection.IP_PORT));
	options.put("medium", TPSettings.TP1);

	int i = 0;
	for (; i < args.length; i++) {
		final String arg = args[i];
		if (isOption(arg, "-help", "-h")) {
			showUsage();
			return false;
		}
		if (isOption(arg, "-version", null)) {
			showVersion();
			return false;
		}
		if (isOption(arg, "-local", "-l"))
			options.put("localDM", null);
		else if (isOption(arg, "-remote", "-r"))
			options.put("remote", new IndividualAddress(args[++i]));
		else if (isOption(arg, "-localhost", null))
			parseIP(args[++i], "localhost", options);
		else if (isOption(arg, "-localport", null))
			options.put("localport", Integer.decode(args[++i]));
		else if (isOption(arg, "-port", "-p"))
			options.put("port", Integer.decode(args[++i]));
		else if (isOption(arg, "-nat", "-n"))
			options.put("nat", null);
		else if (isOption(arg, "-serial", "-s"))
			options.put("serial", null);
		else if (isOption(arg, "-medium", "-m"))
			options.put("medium", getMedium(args[++i]));
		else if (isOption(arg, "-connect", "-c"))
			options.put("connect", null);
		else if (isOption(arg, "-authorize", "-a"))
			options.put("authorize", getAuthorizeKey(args[++i]));
		else if (isOption(arg, "-routing", null))
			options.put("routing", null);
		// IP configuration options
		else if (arg.equalsIgnoreCase("manual"))
			options.put("manual", null);
		else if (arg.equalsIgnoreCase("BootP"))
			options.put("BootP", null);
		else if (arg.equalsIgnoreCase("DHCP"))
			options.put("DHCP", null);
		else if (arg.equalsIgnoreCase("AutoIP"))
			options.put("AutoIP", null);
		else if (arg.equalsIgnoreCase("IP"))
			parseIP(args[++i], "IP", options);
		else if (arg.equalsIgnoreCase("subnet"))
			parseIP(args[++i], "subnet", options);
		else if (arg.equalsIgnoreCase("gateway"))
			parseIP(args[++i], "gateway", options);
		else if (arg.equalsIgnoreCase("multicast"))
			parseIP(args[++i], "multicast", options);
		// add option as port identifier or host name
		else if (options.containsKey("serial"))
			options.put("serial", arg);
		else if (!options.containsKey("host"))
			parseIP(arg, "host", options);
		else
			throw new IllegalArgumentException("unknown option " + arg);
	}
	if (!options.containsKey("localDM") && !options.containsKey("remote"))
		throw new IllegalArgumentException("no connection category specified");
	if (!options.containsKey("host") && !options.containsKey("serial"))
		throw new IllegalArgumentException("no host or serial port specified");
	if (options.containsKey("serial") && !options.containsKey("remote"))
		throw new IllegalArgumentException("-remote option is mandatory with -serial");
	return true;
}
 
开发者ID:ow2-chameleon,项目名称:fuchsia,代码行数:80,代码来源:IPConfig.java


示例10: parseOptions

import tuwien.auto.calimero.link.medium.TPSettings; //导入依赖的package包/类
/**
 * Reads all options in the specified array, and puts relevant options into the
 * supplied options map.
 * <p>
 * On options not relevant for doing network monitoring (like <code>help</code>),
 * this method will take appropriate action (like showing usage information). On
 * occurrence of such an option, other options will be ignored. On unknown options, an
 * IllegalArgumentException is thrown.
 *
 * @param args array with command line options
 * @param options map to store options, optionally with its associated value
 * @return <code>true</code> if the supplied provide enough information to continue
 *         with monitoring, <code>false</code> otherwise or if the options were
 *         handled by this method
 */
private static boolean parseOptions(String[] args, Map options)
{
	if (args.length == 0) {
		System.out.println("A tool for monitoring a KNX network");
		showVersion();
		System.out.println("type -help for help message");
		return false;
	}
	// add defaults
	options.put("port", new Integer(KNXnetIPConnection.IP_PORT));
	options.put("medium", TPSettings.TP1);

	int i = 0;
	for (; i < args.length; i++) {
		final String arg = args[i];
		if (isOption(arg, "-help", "-h")) {
			showUsage();
			return false;
		}
		if (isOption(arg, "-version", null)) {
			showVersion();
			return false;
		}
		if (isOption(arg, "-verbose", "-v"))
			options.put("verbose", null);
		else if (isOption(arg, "-localhost", null))
			parseHost(args[++i], true, options);
		else if (isOption(arg, "-localport", null))
			options.put("localport", Integer.decode(args[++i]));
		else if (isOption(arg, "-port", "-p"))
			options.put("port", Integer.decode(args[++i]));
		else if (isOption(arg, "-nat", "-n"))
			options.put("nat", null);
		else if (isOption(arg, "-serial", "-s"))
			options.put("serial", null);
		else if (isOption(arg, "-medium", "-m"))
			options.put("medium", getMedium(args[++i]));
		else if (options.containsKey("serial"))
			// add port number/identifier to serial option
			options.put("serial", arg);
		else if (!options.containsKey("host"))
			parseHost(arg, false, options);
		else
			throw new IllegalArgumentException("unknown option " + arg);
	}
	return true;
}
 
开发者ID:ow2-chameleon,项目名称:fuchsia,代码行数:63,代码来源:NetworkMonitor.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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