当前位置: 首页>>代码示例>>Java>>正文


Java Priority类代码示例

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


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

示例1: readFromGroup

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

示例2: send

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

示例3: createEMI

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

示例4: readAddress

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

import tuwien.auto.calimero.Priority; //导入依赖的package包/类
private synchronized byte[] sendWait2(Destination d, Priority p, byte[] apdu,
	int response, int minASDULen, int maxASDULen) throws KNXDisconnectException,
	KNXTimeoutException, KNXInvalidResponseException, KNXLinkClosedException
{
	try {
		svcResponse = response;
		if (d.isConnectionOriented()) {
			tl.connect(d);
			tl.sendData(d, p, apdu);
		}
		else
			tl.sendData(d.getAddress(), p, apdu);
		return waitForResponse(minASDULen, maxASDULen);
	}
	finally {
		svcResponse = 0;
	}
}
 
开发者ID:ow2-chameleon,项目名称:fuchsia,代码行数:19,代码来源:ManagementClientImpl.java

示例6: readBroadcast

import tuwien.auto.calimero.Priority; //导入依赖的package包/类
private synchronized List readBroadcast(Priority p, byte[] apdu, int response,
	int minASDULen, int maxASDULen, boolean oneOnly) throws KNXLinkClosedException,
	KNXInvalidResponseException, KNXTimeoutException
{
	final List l = new ArrayList();
	try {
		svcResponse = response;
		tl.broadcast(true, p, apdu);
		long wait = responseTimeout * 1000;
		final long end = System.currentTimeMillis() + wait;
		while (wait > 0) {
			l.add(waitForResponse(minASDULen, maxASDULen, wait));
			if (oneOnly)
				break;
			wait = end - System.currentTimeMillis();
		}
	}
	catch (final KNXTimeoutException e) {
		if (l.isEmpty())
			throw e;
	}
	finally {
		svcResponse = 0;
	}
	return l;
}
 
开发者ID:ow2-chameleon,项目名称:fuchsia,代码行数:27,代码来源:ManagementClientImpl.java

示例7: readFromGroup

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

示例8: createFromEMI

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

示例9: write

import tuwien.auto.calimero.Priority; //导入依赖的package包/类
private void write(final GroupAddress dst, final Priority p, final DPTXlator t, int service)
        throws KNXTimeoutException, KNXLinkClosedException {
    if (detached) {
        throw new KNXIllegalStateException("process communicator detached");
    }
    if (service != GROUP_WRITE && service != GROUP_RESPONSE) {
        throw new IllegalArgumentException("Service " + service + " not supported for sending");
    }
    lnk.sendRequestWait(dst, p, createGroupAPDU(service, t));
    if (logger.isLoggable(LogLevel.TRACE)) {
        logger.trace("group write to " + dst + " succeeded");
    }
}
 
开发者ID:tuxedo0801,项目名称:slicKnx,代码行数:14,代码来源:SlicKnxProcessCommunicatorImpl.java

示例10: TP1LData

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

示例11: TP1LPollData

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

示例12: writeAddress

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

示例13: sendWait

import tuwien.auto.calimero.Priority; //导入依赖的package包/类
private synchronized byte[] sendWait(Destination d, Priority p, byte[] apdu,
	int response, int minASDULen, int maxASDULen) throws KNXDisconnectException,
	KNXTimeoutException, KNXInvalidResponseException, KNXLinkClosedException
{
	try {
		svcResponse = response;
		tl.sendData(d, p, apdu);
		return waitForResponse(minASDULen, maxASDULen);
	}
	finally {
		svcResponse = 0;
	}
}
 
开发者ID:ow2-chameleon,项目名称:fuchsia,代码行数:14,代码来源:ManagementClientImpl.java

示例14: connect

import tuwien.auto.calimero.Priority; //导入依赖的package包/类
public void connect(Destination d) throws KNXTimeoutException, KNXLinkClosedException
{
	final AggregatorProxy p = getProxy(d);
	if (!d.isConnectionOriented()) {
		logger.error("destination not connection oriented: " + d.getAddress());
		return;
	}
	if (d.getState() != Destination.DISCONNECTED)
		return;
	p.setState(Destination.CONNECTING);
	final byte[] tpdu = new byte[] { (byte) CONNECT };
	lnk.sendRequestWait(d.getAddress(), Priority.SYSTEM, tpdu);
	p.setState(Destination.OPEN_IDLE);
	logger.trace("connected with " + d.getAddress());
}
 
开发者ID:ow2-chameleon,项目名称:fuchsia,代码行数:16,代码来源:TransportLayerImpl.java

示例15: sendData

import tuwien.auto.calimero.Priority; //导入依赖的package包/类
public void sendData(KNXAddress addr, Priority p, byte[] tsdu)
	throws KNXTimeoutException, KNXLinkClosedException
{
	if (detached)
		throw new KNXIllegalStateException("TL detached");
	tsdu[0] &= 0x03;
	lnk.sendRequestWait(addr, p, tsdu);
}
 
开发者ID:ow2-chameleon,项目名称:fuchsia,代码行数:9,代码来源:TransportLayerImpl.java


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