本文整理汇总了Java中tuwien.auto.calimero.GroupAddress类的典型用法代码示例。如果您正苦于以下问题:Java GroupAddress类的具体用法?Java GroupAddress怎么用?Java GroupAddress使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GroupAddress类属于tuwien.auto.calimero包,在下文中一共展示了GroupAddress类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
}
示例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;
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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;
}
});
}
}
示例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;
}
示例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");
}
}
示例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;
}
示例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;
}
示例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());
}
示例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);
}