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

Java GroupAddress类代码示例

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

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



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

示例1: fireGroupReadWrite

import tuwien.auto.calimero.GroupAddress; //导入依赖的package包/类
private void fireGroupReadWrite(final CEMILData f, final byte[] asdu, final int svc,
        final boolean optimized) {
    final ProcessEvent e = new ProcessEvent(SlicKnxProcessCommunicatorImpl.this, f.getSource(),
            (GroupAddress) f.getDestination(), svc, asdu, optimized);
    final EventListener[] el = listeners.listeners();
    for (EventListener l : el) {
        try {
            if (svc == GROUP_READ && l instanceof ProcessListenerEx) {
                ((ProcessListenerEx) l).groupReadRequest(e);
            } else if (svc == GROUP_RESPONSE && l instanceof ProcessListenerEx) {
                ((ProcessListenerEx) l).groupReadResponse(e);
            } else {
                ((ProcessListener) l).groupWrite(e);
            }
        } catch (final RuntimeException rte) {
            removeProcessListener((ProcessListener) l);
            logger.error("removed event listener", rte);
        }
    }
}
 
开发者ID:tuxedo0801,项目名称:slicKnx,代码行数:21,代码来源:SlicKnxProcessCommunicatorImpl.java


示例2: readFromGroup

import tuwien.auto.calimero.GroupAddress; //导入依赖的package包/类
private synchronized byte[] readFromGroup(final GroupAddress dst, final Priority p,
        final int minASDULen, final int maxASDULen) throws KNXTimeoutException,
        KNXInvalidResponseException, KNXLinkClosedException, InterruptedException {
    if (detached) {
        throw new KNXIllegalStateException("process communicator detached");
    }
    try {
        wait = true;

        // before sending a request and waiting for response, clear previous indications
        // that could be sitting there from previous timed-out commands or by another request
        // for the same group
        synchronized (indications) {
            indications.clear();
        }
        lnk.sendRequestWait(dst, p, DataUnitBuilder.createLengthOptimizedAPDU(GROUP_READ, null));
        if (logger.isLoggable(LogLevel.TRACE)) {
            logger.trace("sent group read request to " + dst);
        }
        return waitForResponse(dst, minASDULen + 2, maxASDULen + 2);
    } finally {
        wait = false;
    }
}
 
开发者ID:tuxedo0801,项目名称:slicKnx,代码行数:25,代码来源:SlicKnxProcessCommunicatorImpl.java


示例3: writeAngle

import tuwien.auto.calimero.GroupAddress; //导入依赖的package包/类
/**
 * DPT 5.003
 *
 * @param isResponse
 * @param ga
 * @param angle value [0..360], i.e. °C
 * @throws de.root1.slicknx.KnxException
 * @throws IllegalArgumentException in case of wrong value
 */
public void writeAngle(boolean isResponse, String ga, int angle) throws KnxException {
    if (angle < 0 || angle > 360) {
        throw new IllegalArgumentException("Angle must be between 0..360, but was: " + angle);
    }
    checkGa(ga);
    try {
        if (isResponse) {
            pc.writeResponse(new GroupAddress(ga), angle, ProcessCommunicationBase.ANGLE);
        } else {
            pc.write(new GroupAddress(ga), angle, ProcessCommunicationBase.ANGLE);
        }
    } catch (KNXTimeoutException | KNXLinkClosedException | KNXFormatException ex) {
        throw new KnxException("Error writing angle", ex);
    }
}
 
开发者ID:tuxedo0801,项目名称:slicKnx,代码行数:25,代码来源:Knx.java


示例4: writeUnscaled

import tuwien.auto.calimero.GroupAddress; //导入依赖的package包/类
/**
 * DPT 5.005 DPT 5.010
 *
 * @param isResponse
 * @param ga
 * @param value value [0..255]
 * @throws de.root1.slicknx.KnxException
 * @throws IllegalArgumentException in case of wrong value
 */
public void writeUnscaled(boolean isResponse, String ga, int value) throws KnxException {
    if (value < 0 || value > 255) {
        throw new IllegalArgumentException("value must be between 0..255, but was: " + value);
    }
    checkGa(ga);
    try {
        if (isResponse) {
            pc.writeResponse(new GroupAddress(ga), value, ProcessCommunicationBase.UNSCALED);
        } else {
            pc.write(new GroupAddress(ga), value, ProcessCommunicationBase.UNSCALED);
        }
    } catch (KNXTimeoutException | KNXLinkClosedException | KNXFormatException ex) {
        throw new KnxException("Error writing unscaled", ex);
    }
}
 
开发者ID:tuxedo0801,项目名称:slicKnx,代码行数:25,代码来源:Knx.java


示例5: writeDpt6

import tuwien.auto.calimero.GroupAddress; //导入依赖的package包/类
/**
 * DPT 6 8-bit signed value
 *
 * @param isResponse
 * @param ga
 * @param value value [-128..127] ^= 8bit signed
 * @throws de.root1.slicknx.KnxException
 */
public void writeDpt6(boolean isResponse, String ga, int value) throws KnxException {
    if (value < -128 || value > 127) {
        throw new IllegalArgumentException("value must be between -128..127, but was: " + value);
    }
    checkGa(ga);
    try {
        StateDP dp = new StateDP(new GroupAddress(ga), "6.001", 6, "6.001");
        if (isResponse) {
            pc.writeResponse(dp, Integer.toString(value));
        } else {
            pc.write(dp, Integer.toString(value));
        }

    } catch (KNXException ex) {
        throw new KnxException("Error writing dpt7", ex);
    }
}
 
开发者ID:tuxedo0801,项目名称:slicKnx,代码行数:26,代码来源:Knx.java


示例6: writeDpt7

import tuwien.auto.calimero.GroupAddress; //导入依赖的package包/类
/**
 * DPT 7 16-bit unsigned value
 *
 * @param isResponse
 * @param ga
 * @param value value [0..65535] ^= 16bit unsigned
 * @throws de.root1.slicknx.KnxException
 * @throws IllegalArgumentException in case of wrong value
 */
public void writeDpt7(boolean isResponse, String ga, int value) throws KnxException {
    if (value < 0 || value > 65535) {
        throw new IllegalArgumentException("value must be between 0..65535, but was: " + value);
    }
    checkGa(ga);
    try {

        StateDP dp = new StateDP(new GroupAddress(ga), "7.001", 7, "7.001");
        if (isResponse) {
            pc.writeResponse(dp, Integer.toString(value));
        } else {
            pc.write(dp, Integer.toString(value));
        }

    } catch (KNXException ex) {
        throw new KnxException("Error writing dpt7", ex);
    }
}
 
开发者ID:tuxedo0801,项目名称:slicKnx,代码行数:28,代码来源:Knx.java


示例7: writeDpt8

import tuwien.auto.calimero.GroupAddress; //导入依赖的package包/类
/**
 * DPT 8 16-bit signed value
 *
 * @param isResponse
 * @param ga
 * @param value value [-32768..32767] ^= 16bit signed
 * @throws de.root1.slicknx.KnxException
 * @throws IllegalArgumentException in case of wrong value
 */
public void writeDpt8(boolean isResponse, String ga, int value) throws KnxException {
    if (value < -32768 || value > 32767) {
        throw new IllegalArgumentException("value must be between -32768..32767, but was: " + value);
    }
    checkGa(ga);
    try {

        StateDP dp = new StateDP(new GroupAddress(ga), "8.001", 7, "8.001");
        if (isResponse) {
            pc.writeResponse(dp, Integer.toString(value));
        } else {
            pc.write(dp, Integer.toString(value));
        }

    } catch (KNXException ex) {
        throw new KnxException("Error writing dpt8", ex);
    }
}
 
开发者ID:tuxedo0801,项目名称:slicKnx,代码行数:28,代码来源:Knx.java


示例8: read

import tuwien.auto.calimero.GroupAddress; //导入依赖的package包/类
/**
 *
 * @param ga
 * @param dpt
 * @return
 */
public String read(String ga, String dpt) throws KnxException {
    checkGa(ga);

    String[] dptSplit = dpt.split("\\.");
    int mainDpt = Integer.parseInt(dptSplit[0]);
    String subDpt = dptSplit[1];

    try {
        String value = pc.read(new StateDP(new GroupAddress(ga), "", mainDpt, dpt));

        return value;
    } catch (KNXException | InterruptedException ex) {
        throw new KnxException("Error reading DPT" + dpt + " from " + ga, ex);
    }
}
 
开发者ID:tuxedo0801,项目名称:slicKnx,代码行数:22,代码来源:Knx.java


示例9: getListeningItemNames

import tuwien.auto.calimero.GroupAddress; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@SuppressWarnings("unchecked")
public Iterable<String> getListeningItemNames(final GroupAddress groupAddress) {
	synchronized(bindingConfigs) {
		Iterable<KNXBindingConfig> configList = Iterables.filter(Iterables.concat(bindingConfigs.values()), KNXBindingConfig.class);
		Iterable<KNXBindingConfigItem> configItemList = Iterables.filter(Iterables.concat(configList), KNXBindingConfigItem.class);
		Iterable<KNXBindingConfigItem> filteredBindingConfigs = Iterables.filter(configItemList,
				new Predicate<KNXBindingConfigItem>() {
					public boolean apply(KNXBindingConfigItem input) {
						if(input==null) {
							return false;
						}
						return input.allDataPoints.contains(groupAddress);
					}
				});
		return Iterables.transform(filteredBindingConfigs, new Function<KNXBindingConfigItem, String>() {
			public String apply(KNXBindingConfigItem from) {
				if(from==null) {
					return null;
				}
				return from.itemName;
			}
		});
	}
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:28,代码来源:KNXGenericBindingProvider.java


示例10: isCommandGA

import tuwien.auto.calimero.GroupAddress; //导入依赖的package包/类
@Override
public boolean isCommandGA(final GroupAddress groupAddress) {
	synchronized(bindingConfigs) {
		for (BindingConfig config : bindingConfigs.values()) {
			KNXBindingConfig knxConfig = (KNXBindingConfig) config;
			for (KNXBindingConfigItem configItem : knxConfig) {
				if (configItem.allDataPoints.contains(groupAddress)) {
					if(configItem.mainDataPoint instanceof CommandDP) {
						if(configItem.mainDataPoint.getMainAddress().equals(groupAddress)) {
							// the first GA in a CommandDP is always a command GA
							return true;
						} else {
							return false;
						}
					} else {
						// it is a StateDP, so the GA cannot be a command GA
						return false;
					}
				}
			}
		}
	}
	return false;
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:25,代码来源:KNXGenericBindingProvider.java


示例11: readWrite

import tuwien.auto.calimero.GroupAddress; //导入依赖的package包/类
private void readWrite() throws KNXException
{
	// check if we are doing a read or write operation
	final boolean read = options.containsKey("read");
	final GroupAddress main = (GroupAddress) options.get(read ? "read" : "write");
	// encapsulate information into a datapoint
	// this is a convenient way to let the process communicator
	// handle the DPT stuff, so an already formatted string will be returned
	final Datapoint dp = new StateDP(main, "", 0, getDPT());
	if (read)
		System.out.println("read value: " + pc.read(dp));
	else {
		// note, a write to a non existing datapoint might finish successfully,
		// too.. no check for existence or read back of a written value is done
		pc.write(dp, (String) options.get("value"));
		System.out.println("write successful");
	}
}
 
开发者ID:gskbyte,项目名称:kora,代码行数:19,代码来源:ProcComm.java


示例12: isCommandGA

import tuwien.auto.calimero.GroupAddress; //导入依赖的package包/类
@Override
public boolean isCommandGA(final GroupAddress groupAddress) {
    synchronized (bindingConfigs) {
        for (BindingConfig config : bindingConfigs.values()) {
            KNXBindingConfig knxConfig = (KNXBindingConfig) config;
            for (KNXBindingConfigItem configItem : knxConfig) {
                if (configItem.allDataPoints.contains(groupAddress)) {
                    if (configItem.mainDataPoint instanceof CommandDP) {
                        if (configItem.mainDataPoint.getMainAddress().equals(groupAddress)) {
                            // the first GA in a CommandDP is always a command GA
                            return true;
                        } else {
                            return false;
                        }
                    } else {
                        // it is a StateDP, so the GA cannot be a command GA
                        return false;
                    }
                }
            }
        }
    }
    return false;
}
 
开发者ID:openhab,项目名称:openhab1-addons,代码行数:25,代码来源:KNXGenericBindingProvider.java


示例13: isStartStopGA

import tuwien.auto.calimero.GroupAddress; //导入依赖的package包/类
/**
 * Determines if the given group address is marked for start-stop dimming.
 *
 * @param groupAddress the group address to check start-stop dimming for
 * @returns true, if the given group address is marked for start-stop dimming, false otherwise.
 */
@Override
public boolean isStartStopGA(GroupAddress groupAddress) {
    synchronized (bindingConfigs) {
        for (BindingConfig config : bindingConfigs.values()) {
            KNXBindingConfig knxConfig = (KNXBindingConfig) config;
            for (KNXBindingConfigItem configItem : knxConfig) {
                Boolean startStopBehavior = configItem.startStopMap.get(groupAddress);
                if (startStopBehavior != null) {
                    return startStopBehavior;
                }
            }
        }
    }
    return false;
}
 
开发者ID:openhab,项目名称:openhab1-addons,代码行数:22,代码来源:KNXGenericBindingProvider.java


示例14: sendTypeToItemButNotToKnx

import tuwien.auto.calimero.GroupAddress; //导入依赖的package包/类
private void sendTypeToItemButNotToKnx(GroupAddress destination, String itemName, Type type) {
    // we need to make sure that we won't send out this event to
    // the knx bus again, when receiving it on the openHAB bus
    ignoreEventList.add(itemName + type.toString());
    logger.trace("Added event (item='{}', type='{}') to the ignore event list", itemName, type.toString());

    if (type instanceof Command && isCommandGA(destination)) {
        eventPublisher.postCommand(itemName, (Command) type);
    } else if (type instanceof State) {
        eventPublisher.postUpdate(itemName, (State) type);
    } else {
        throw new IllegalClassException("Cannot process datapoint of type " + type.toString());
    }

    logger.trace("Processed event (item='{}', type='{}', destination='{}')", itemName, type.toString(),
            destination.toString());
}
 
开发者ID:openhab,项目名称:openhab1-addons,代码行数:18,代码来源:KNXBinding.java


示例15: send

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


示例16: createEMI

import tuwien.auto.calimero.GroupAddress; //导入依赖的package包/类
private byte[] createEMI(int mc, KNXAddress dst, Priority p, byte[] nsdu)
{
	if (nsdu.length > 16)
		throw new KNXIllegalArgumentException(
			"maximum TPDU length is 16 in standard frame");
	// TP1, standard frames only
	final byte[] buf = new byte[nsdu.length + 7];
	buf[0] = (byte) mc;
	// ack don't care
	buf[1] = (byte) (p.value << 2);
	// on dst null, default address 0 is used
	// (null indicates system broadcast in link API)
	final int d = dst != null ? dst.getRawAddress() : 0;
	buf[4] = (byte) (d >> 8);
	buf[5] = (byte) d;
	buf[6] = (byte) (hopCount << 4 | (nsdu.length - 1));
	if (dst instanceof GroupAddress)
		buf[6] |= 0x80;
	for (int i = 0; i < nsdu.length; ++i)
		buf[7 + i] = nsdu[i];
	return buf;
}
 
开发者ID:ow2-chameleon,项目名称:fuchsia,代码行数:23,代码来源:KNXNetworkLinkFT12.java


示例17: doSave

import tuwien.auto.calimero.GroupAddress; //导入依赖的package包/类
void doSave(XMLWriter w) throws KNXMLException
{
	// <expiration timeout=int />
	w.writeEmptyElement(TAG_EXPIRATION, Arrays
		.asList(new Attribute[] { new Attribute(ATTR_TIMEOUT, Integer
			.toString(timeout)) }));
	w.writeElement(TAG_UPDATING, Collections.EMPTY_LIST, null);
	synchronized (updating) {
		for (final Iterator i = updating.iterator(); i.hasNext();)
			((GroupAddress) i.next()).save(w);
	}
	w.endElement();
	w.writeElement(TAG_INVALIDATING, Collections.EMPTY_LIST, null);
	synchronized (invalidating) {
		for (final Iterator i = invalidating.iterator(); i.hasNext();)
			((GroupAddress) i.next()).save(w);
	}
	w.endElement();
}
 
开发者ID:ow2-chameleon,项目名称:fuchsia,代码行数:20,代码来源:StateDP.java


示例18: fireGroupReadWrite

import tuwien.auto.calimero.GroupAddress; //导入依赖的package包/类
private void fireGroupReadWrite(CEMILData f, byte[] asdu, int svc)
{
	final ProcessEvent e =
		new ProcessEvent(ProcessCommunicatorImpl.this, f.getSource(),
			(GroupAddress) f.getDestination(), asdu);
	for (final Iterator i = listeners.iterator(); i.hasNext();) {
		final Object l = i.next();
		try {
			if (svc == GROUP_READ && l instanceof ProcessListenerEx)
				((ProcessListenerEx) l).groupReadRequest(e);
			else if (svc == GROUP_RESPONSE
				&& l instanceof ProcessListenerEx)
				((ProcessListenerEx) l).groupReadResponse(e);
			else
				((ProcessListener) l).groupWrite(e);
		}
		catch (final RuntimeException rte) {
			removeProcessListener((ProcessListener) l);
			logger.error("removed event listener", rte);
		}
	}
}
 
开发者ID:ow2-chameleon,项目名称:fuchsia,代码行数:23,代码来源:ProcessCommunicatorImpl.java


示例19: readFromGroup

import tuwien.auto.calimero.GroupAddress; //导入依赖的package包/类
private synchronized byte[] readFromGroup(GroupAddress dst, Priority p,
	int minASDULen, int maxASDULen) throws KNXTimeoutException,
	KNXInvalidResponseException, KNXLinkClosedException
{
	if (detached)
		throw new KNXIllegalStateException("process communicator detached");
	try {
		wait = true;
		lnk.sendRequestWait(dst, p, DataUnitBuilder.createCompactAPDU(
			GROUP_READ, null));
		logger.trace("sent group read request to " + dst);
		return waitForResponse(minASDULen + 2, maxASDULen + 2);
	}
	finally {
		wait = false;
	}
}
 
开发者ID:ow2-chameleon,项目名称:fuchsia,代码行数:18,代码来源:ProcessCommunicatorImpl.java


示例20: request

import tuwien.auto.calimero.GroupAddress; //导入依赖的package包/类
public CEMILData request(KNXAddress dst, Configuration c)
{
	final Cache cache = c.getCache();
	if (cache == null || !(dst instanceof GroupAddress))
		return null;
	final LDataObject o = (LDataObject) cache.get(dst);
	if (o == null)
		return null;
	// check if there is an expiration timeout for a state based value
	final Datapoint dp;
	final DatapointModel m = c.getDatapointModel();
	if (m != null && (dp = m.get((GroupAddress) dst)) != null && dp.isStateBased()) {
		final int t = ((StateDP) dp).getExpirationTimeout() * 1000;
		if (t != 0 && System.currentTimeMillis() > o.getTimestamp() + t)
			return null;
	}
	return o.getFrame();
}
 
开发者ID:ow2-chameleon,项目名称:fuchsia,代码行数:19,代码来源:StateFilter.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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