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

Java IndividualAddress类代码示例

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

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



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

示例1: connectByIp

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


示例2: connectByIp

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


示例3: send

import tuwien.auto.calimero.IndividualAddress; //导入依赖的package包/类
private void send(KNXAddress dst, Priority p, byte[] nsdu, boolean confirm)
	throws KNXTimeoutException, KNXLinkClosedException
{
	final CEMILData f;
	final short mc = mode == TUNNEL ? CEMILData.MC_LDATA_REQ : CEMILData.MC_LDATA_IND;
	final IndividualAddress src = medium.getDeviceAddress();
	// use default address 0 in system broadcast
	final KNXAddress d = dst == null ? new GroupAddress(0) : dst;
	final boolean tp = medium.getMedium() == KNXMediumSettings.MEDIUM_TP0
		|| medium.getMedium() == KNXMediumSettings.MEDIUM_TP1;
	if (nsdu.length <= 16 && tp)
		f = new CEMILData(mc, src, d, nsdu, p, true, hopCount);
	else
		f = new CEMILDataEx(mc, src, d, nsdu, p, true, dst != null, false, hopCount);
	doSend(f, confirm);
}
 
开发者ID:ow2-chameleon,项目名称:fuchsia,代码行数:17,代码来源:KNXNetworkLinkIP.java


示例4: readAddress

import tuwien.auto.calimero.IndividualAddress; //导入依赖的package包/类
public synchronized IndividualAddress[] readAddress(boolean oneAddressOnly)
	throws KNXTimeoutException, KNXRemoteException, KNXLinkClosedException
{
	final List l = new ArrayList();
	try {
		svcResponse = IND_ADDR_RESPONSE;
		tl.broadcast(false, Priority.SYSTEM, DataUnitBuilder.createCompactAPDU(
			IND_ADDR_READ, null));
		long wait = responseTimeout * 1000;
		final long end = System.currentTimeMillis() + wait;
		while (wait > 0) {
			l.add(new IndividualAddress(waitForResponse(0, 0, wait)));
			if (oneAddressOnly)
				break;
			wait = end - System.currentTimeMillis();
		}
	}
	catch (final KNXTimeoutException e) {
		if (l.isEmpty())
			throw e;
	}
	finally {
		svcResponse = 0;
	}
	return (IndividualAddress[]) l.toArray(new IndividualAddress[l.size()]);
}
 
开发者ID:ow2-chameleon,项目名称:fuchsia,代码行数:27,代码来源:ManagementClientImpl.java


示例5: createDestination

import tuwien.auto.calimero.IndividualAddress; //导入依赖的package包/类
/**
 * {@inheritDoc} Only one destination can be created per remote address. If a
 * destination with the supplied remote address already exists for this transport
 * layer, a {@link KNXIllegalArgumentException} is thrown.<br>
 * A transport layer can only handle one connection per destination, because it can't
 * distinguish incoming messages between more than one connection.
 */
public Destination createDestination(IndividualAddress remote,
	boolean connectionOriented, boolean keepAlive, boolean verifyMode)
{
	if (detached)
		throw new KNXIllegalStateException("TL detached");
	synchronized (proxies) {
		if (proxies.containsKey(remote))
			throw new KNXIllegalArgumentException("destination already created: "
				+ remote);
		final AggregatorProxy p = new AggregatorProxy(this);
		final Destination d =
			new Destination(p, remote, connectionOriented, keepAlive, verifyMode);
		proxies.put(remote, p);
		logger.trace("destination " + remote + " ready for use");
		return d;
	}
}
 
开发者ID:ow2-chameleon,项目名称:fuchsia,代码行数:25,代码来源:TransportLayerImpl.java


示例6: createFromEMI

import tuwien.auto.calimero.IndividualAddress; //导入依赖的package包/类
/**
 * Creates a new cEMI message out of the supplied EMI frame.
 * <p>
 * 
 * @param frame EMI frame
 * @return the new cEMI message
 * @throws KNXFormatException if no (valid) EMI structure was found or unsupported EMI
 *         message code
 */
public static CEMI createFromEMI(byte[] frame) throws KNXFormatException
{
	// check for minimum frame length (i.e. busmonitor)
	if (frame.length < 4)
		throw new KNXFormatException("EMI frame too short");
	final int mc = frame[0] & 0xff;
	if (mc == CEMIBusMon.MC_BUSMON_IND) {
		return new CEMIBusMon(frame[1] & 0xff, (frame[2] & 0xff) << 8 | frame[3] & 0xff,
			false, truncate(frame, 4, frame.length - 4));
	}
	final Priority p = Priority.get(frame[1] >> 2 & 0x3);
	final boolean ack = (frame[1] & 0x02) != 0;
	final boolean c = (frame[1] & 0x01) != 0;
	final int dst = (frame[4] & 0xff) << 8 | frame[5] & 0xff;
	final KNXAddress a = (frame[6] & 0x80) != 0 ?
		(KNXAddress) new GroupAddress(dst) : new IndividualAddress(dst);
	final int hops = frame[6] >> 4 & 0x07;
	final int len = (frame[6] & 0x0f) + 1;
	final byte[] tpdu = truncate(frame, 7, Math.min(len, frame.length - 7));
	// no long frames in EMI2
	return c ? new CEMILData(mc, new IndividualAddress(0), a, tpdu, p, c)
		: new CEMILData(mc, new IndividualAddress(0), a, tpdu, p, true, true, ack,
			hops);
}
 
开发者ID:ow2-chameleon,项目名称:fuchsia,代码行数:34,代码来源:CEMIFactory.java


示例7: create

import tuwien.auto.calimero.IndividualAddress; //导入依赖的package包/类
private static CEMI create(int msgCode, IndividualAddress src, KNXAddress dst,
	byte[] data, CEMILData original, boolean ext)
{
	final int mc = msgCode != 0 ? msgCode : original.getMessageCode();
	final IndividualAddress s = src != null ? src : original.getSource();
	final KNXAddress d = dst != null ? dst : original.getDestination();
	final byte[] content = data != null ? data : original.getPayload();
	if (original instanceof CEMILDataEx) {
		final CEMILDataEx f = (CEMILDataEx) original;
		final CEMILDataEx copy =
			new CEMILDataEx(mc, s, d, content, f.getPriority(), f.isRepetition(), f
				.isDomainBroadcast(), f.isAckRequested(), f.getHopCount());
		// copy additional info
		final List l = f.getAdditionalInfo();
		for (final Iterator i = l.iterator(); i.hasNext();) {
			final CEMILDataEx.AddInfo info = (CEMILDataEx.AddInfo) i.next();
			copy.addAdditionalInfo(info.getType(), info.getInfo());
		}
		return copy;
	}
	if (ext)
		return new CEMILDataEx(mc, s, d, content, original.getPriority(), original
			.isRepetition(), original.getHopCount());
	return new CEMILData(mc, s, d, content, original.getPriority(), original
		.isRepetition(), original.getHopCount());
}
 
开发者ID:ow2-chameleon,项目名称:fuchsia,代码行数:27,代码来源:CEMIFactory.java


示例8: DeviceDIB

import tuwien.auto.calimero.IndividualAddress; //导入依赖的package包/类
/**
 * Creates a device DIB out of a byte array.
 * <p>
 * 
 * @param data byte array containing device DIB structure
 * @param offset start offset of DIB in <code>data</code>
 * @throws KNXFormatException if no DIB found or invalid structure
 */
public DeviceDIB(byte[] data, int offset) throws KNXFormatException
{
	super(data, offset);
	if (type != DEVICE_INFO)
		throw new KNXFormatException("DIB is not of type device info", type);
	if (size < DIB_SIZE)
		throw new KNXFormatException("device info DIB too short", size);
	final ByteArrayInputStream is =
		new ByteArrayInputStream(data, offset + 2, data.length - offset - 2);
	knxmedium = (short) is.read();
	devicestatus = (short) is.read();
	address =
		new IndividualAddress(new byte[] { (byte) is.read(), (byte) is.read(), });
	projectInstallID = (is.read() << 8) | is.read();
	is.read(serial, 0, serial.length);
	is.read(mcaddress, 0, mcaddress.length);
	is.read(mac, 0, mac.length);

	// device friendly name is optional
	final StringBuffer sbuf = new StringBuffer(30);
	int i = 30;
	for (int c = is.read(); i > 0 && c > 0; --i, c = is.read())
		sbuf.append((char) c);
	name = sbuf.toString();
}
 
开发者ID:ow2-chameleon,项目名称:fuchsia,代码行数:34,代码来源:DeviceDIB.java


示例9: setIndividualAddress

import tuwien.auto.calimero.IndividualAddress; //导入依赖的package包/类
/**
 * sets the own physical, individual address. f.i. "1.1.123"
 *
 * @param individualAddress individual address with dot-notation. f.i.
 * "1.1.123"
 * @throws KnxException
 */
public void setIndividualAddress(String individualAddress) throws KnxException {
    try {
        netlink.getKNXMedium().setDeviceAddress(new IndividualAddress(individualAddress));
        this.individualAddress = individualAddress;
    } catch (KNXFormatException ex) {
        throw new KnxException("Error setting indiviaual address to " + individualAddress, ex);
    }
}
 
开发者ID:tuxedo0801,项目名称:slicKnx,代码行数:16,代码来源:Knx.java


示例10: getIndividualAddress

import tuwien.auto.calimero.IndividualAddress; //导入依赖的package包/类
public static IndividualAddress getIndividualAddress(String address) throws KnxException {
    try {
        IndividualAddress ia = new IndividualAddress(address);
        return ia;
    } catch (KNXFormatException ex) {
        throw new KnxException("Individual address format not correct.", ex);
    }
}
 
开发者ID:tuxedo0801,项目名称:slicKnx,代码行数:9,代码来源:Utils.java


示例11: KNXComm

import tuwien.auto.calimero.IndividualAddress; //导入依赖的package包/类
/**
 * Open a connection with the IP gateway
 * 
 * @param p_GatewayIP
 *            The IP of the gateway
 * @param p_GatewayKNXAddr
 *            The individual KNX address of the gateway
 * @throws KNXException
 * @throws SocketException
 */
private KNXComm(String p_GatewayIP, String p_GatewayKNXAddr)
		throws KNXException, SocketException {
	m_GatewayIP = p_GatewayIP;
	m_settings = new KNXMediumSettings(new IndividualAddress(
			p_GatewayKNXAddr)) {
		@Override
		public short getMedium() {
			return KNXMediumSettings.MEDIUM_TP1;
		}
	};

	// m_link = new KNXNetworkLinkIP(p_GatewayIP, l_settings);
	openConnection();
}
 
开发者ID:heia-fr,项目名称:wot_gateways,代码行数:25,代码来源:KNXComm.java


示例12: TP1LData

import tuwien.auto.calimero.IndividualAddress; //导入依赖的package包/类
/**
 * Creates a new L-data frame out of a byte array.
 * <p>
 * 
 * @param data byte array containing the L-data frame
 * @param offset start offset of frame structure in <code>data</code>, offset &gt;=
 *        0
 * @throws KNXFormatException if length of data too short for frame, on no valid frame
 *         structure
 */
public TP1LData(byte[] data, int offset) throws KNXFormatException
{
	final ByteArrayInputStream is =
		new ByteArrayInputStream(data, offset, data.length - offset);
	final int avail = is.available();
	if (avail < MIN_LENGTH)
		throw new KNXFormatException("data too short for L-data frame", avail);
	final int ctrl = is.read();
	// parse control field and check if valid
	if ((ctrl & 0x53) != 0x10)
		throw new KNXFormatException("invalid control field", ctrl);

	type = LDATA_FRAME;
	ext = (ctrl & 0x80) == 0;
	repetition = (ctrl & 0x20) == 0;
	p = Priority.get((ctrl >> 2) & 0x3);

	final int ctrle = ext ? readCtrlEx(is) : 0;
	src = new IndividualAddress((is.read() << 8) | is.read());
	final int addr = (is.read() << 8) | is.read();
	final int npci = is.read();
	final int len;
	if (ext) {
		hopcount = (ctrle & 0x70) >> 4;
		setDestination(addr, (ctrle & 0x80) != 0);
		len = npci;
		if (len == 255)
			throw new KNXFormatException("escape-code in length field not supported");
	}
	else {
		hopcount = (npci & 0x70) >> 4;
		setDestination(addr, (npci & 0x80) != 0);
		len = npci & 0x0f;
	}
	tpdu = new byte[len + 1];
	if (is.read(tpdu, 0, tpdu.length) != tpdu.length)
		throw new KNXFormatException("data too short for L-data TPDU");
	fcs = is.read();
}
 
开发者ID:ow2-chameleon,项目名称:fuchsia,代码行数:50,代码来源:TP1LData.java


示例13: TP1LPollData

import tuwien.auto.calimero.IndividualAddress; //导入依赖的package包/类
/**
 * Creates a new L-polldata frame out of a byte array.
 * <p>
 * 
 * @param data byte array containing the L-polldata frame
 * @param offset start offset of frame structure in <code>data</code>, offset &gt;=
 *        0
 * @throws KNXFormatException if length of data too short for frame, on no valid frame
 *         structure
 */
public TP1LPollData(byte[] data, int offset) throws KNXFormatException
{
	final ByteArrayInputStream is =
		new ByteArrayInputStream(data, offset, data.length - offset);
	final int avail = is.available();
	if (avail < MIN_LENGTH)
		throw new KNXFormatException("data too short for L-polldata frame", avail);
	final int ctrl = is.read();
	// parse control field and check if valid
	if (ctrl != 0xF0)
		throw new KNXFormatException("invalid control field", ctrl);
	type = LPOLLDATA_FRAME;
	p = Priority.get((ctrl >> 2) & 0x3);
	int addr = (is.read() << 8) | is.read();
	src = new IndividualAddress(addr);
	addr = (is.read() << 8) | is.read();
	dst = new GroupAddress(addr);
	final int len = is.read() & 0x0f;
	expData = len;
	fcs = is.read();
	// do we really get poll data response here? don't know for sure..
	if (expData <= is.available()) {
		tpdu = new byte[expData];
		is.read(tpdu, 0, expData);
	}
}
 
开发者ID:ow2-chameleon,项目名称:fuchsia,代码行数:37,代码来源:TP1LPollData.java


示例14: writeAddress

import tuwien.auto.calimero.IndividualAddress; //导入依赖的package包/类
public void writeAddress(byte[] serialNo, IndividualAddress newAddress)
	throws KNXTimeoutException, KNXLinkClosedException
{
	if (serialNo.length != 6)
		throw new KNXIllegalArgumentException("length of serial number not 6 bytes");
	final byte[] asdu = new byte[12];
	for (int i = 0; i < 6; ++i)
		asdu[i] = serialNo[i];
	asdu[6] = (byte) (newAddress.getRawAddress() >>> 8);
	asdu[7] = (byte) newAddress.getRawAddress();
	tl.broadcast(false, Priority.SYSTEM, DataUnitBuilder.createAPDU(
		IND_ADDR_SN_WRITE, asdu));
}
 
开发者ID:ow2-chameleon,项目名称:fuchsia,代码行数:14,代码来源:ManagementClientImpl.java


示例15: readDomainAddress

import tuwien.auto.calimero.IndividualAddress; //导入依赖的package包/类
public List readDomainAddress(byte[] domain, IndividualAddress start, int range)
	throws KNXInvalidResponseException, KNXLinkClosedException, KNXTimeoutException
{
	if (domain.length != 2)
		throw new KNXIllegalArgumentException("length of domain address not 2 bytes");
	if (range < 0 || range > 255)
		throw new KNXIllegalArgumentException("range out of range [0..255]");
	final byte[] addr = start.toByteArray();
	return makeDOAs(readBroadcast(priority, DataUnitBuilder.createAPDU(
		DOA_SELECTIVE_READ, new byte[] { domain[0], domain[1], addr[0], addr[1],
			(byte) range }), DOA_RESPONSE, 2, 2, false));
}
 
开发者ID:ow2-chameleon,项目名称:fuchsia,代码行数:13,代码来源:ManagementClientImpl.java


示例16: RemotePropertyServiceAdapter

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


示例17: sendDisconnect

import tuwien.auto.calimero.IndividualAddress; //导入依赖的package包/类
private void sendDisconnect(IndividualAddress addr) throws KNXLinkClosedException
{
	final byte[] tpdu = new byte[] { (byte) DISCONNECT };
	try {
		lnk.sendRequest(addr, Priority.SYSTEM, tpdu);
	}
	catch (final KNXTimeoutException ignore) {
		// do a warning, but otherwise can be ignored
		logger.warn("disconnected not gracefully (timeout)", ignore);
	}
}
 
开发者ID:ow2-chameleon,项目名称:fuchsia,代码行数:12,代码来源:TransportLayerImpl.java


示例18: readConfig

import tuwien.auto.calimero.IndividualAddress; //导入依赖的package包/类
private void readConfig() throws KNXException
{
	final List config = new ArrayList();
	int pid = PropertyClient.PID.KNX_INDIVIDUAL_ADDRESS;
	byte[] data = query(pid);
	if (data != null)
		add(config, pid, "KNXnet/IP server", new IndividualAddress(data).toString());
	add(config, PropertyClient.PID.FRIENDLY_NAME, "name", queryFriendlyName());

	pid = PropertyClient.PID.IP_CAPABILITIES;
	if ((data = query(pid)) != null)
		add(config, pid, "IP address assignment available",
			getIPAssignment(new byte[] { (byte) (data[0] << 1 | 0x01) }));

	pid = PropertyClient.PID.IP_ASSIGNMENT_METHOD;
	if ((data = query(pid)) != null)
		add(config, pid, "IP address assignment enabled", getIPAssignment(data));

	pid = PropertyClient.PID.CURRENT_IP_ASSIGNMENT_METHOD;
	if ((data = query(pid)) != null)
		add(config, pid, "IP address assignment current", getIPAssignment(data));

	pid = PropertyClient.PID.KNXNETIP_ROUTING_CAPABILITIES;
	if ((data = query(pid)) != null)
		add(config, pid, "routing capabilities", getRoutingCaps(data));

	addIP(config, PropertyClient.PID.IP_ADDRESS, "IP address configured");
	addIP(config, PropertyClient.PID.CURRENT_IP_ADDRESS, "IP address current");
	addIP(config, PropertyClient.PID.SUBNET_MASK, "subnet mask configured");
	addIP(config, PropertyClient.PID.CURRENT_SUBNET_MASK, "subnet mask  current");
	addIP(config, PropertyClient.PID.DEFAULT_GATEWAY, "default gateway configured");
	addIP(config, PropertyClient.PID.CURRENT_DEFAULT_GATEWAY,
		"default gateway current");
	addIP(config, PropertyClient.PID.DHCP_BOOTP_SERVER, "DHCP/BootP server");
	addIP(config, PropertyClient.PID.ROUTING_MULTICAST_ADDRESS, "routing multicast");

	receivedConfig(config);
}
 
开发者ID:ow2-chameleon,项目名称:fuchsia,代码行数:39,代码来源:IPConfig.java


示例19: getAddress

import tuwien.auto.calimero.IndividualAddress; //导入依赖的package包/类
public IndividualAddress getAddress() {
    return address;
}
 
开发者ID:tuxedo0801,项目名称:slicKnx,代码行数:4,代码来源:KnxInterfaceDevice.java


示例20: MsgWriteIndividualAddress

import tuwien.auto.calimero.IndividualAddress; //导入依赖的package包/类
public MsgWriteIndividualAddress(String address) throws KnxException {
    super(MSGTYPE_WRITE_INDIVIDUAL_ADDRESS);
    IndividualAddress ia = Utils.getIndividualAddress(address);
    System.arraycopy(ia.toByteArray(), 0, data, 2, 2);
}
 
开发者ID:KONNEKTING,项目名称:KonnektingDeviceConfig,代码行数:6,代码来源:MsgWriteIndividualAddress.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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