Giter Site home page Giter Site logo

Comments (2)

bmalinowsky avatar bmalinowsky commented on August 30, 2024

No, the FT1.2 transmission protocol itself is not concerned with KNX.

For Weinzierl, you can try the following utility:

import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;

import tuwien.auto.calimero.Connection.BlockingMode;
import tuwien.auto.calimero.KNXException;
import tuwien.auto.calimero.serial.FT12Connection;

/**
 * PEI check for Weinzierl FT1.2 cEMI support.
 * Compile-time jar deps: calimero-core, calimero-rxtx+nrjavaserial, slf4j-api
 */
public final class WeinzierlFt12CemiSupport {
	private static final int peiIdentifyReq = 0xa7;
	private static final int peiIdentifyCon = 0xa8;

	public static void main(final String[] args) throws KNXException, InterruptedException, TimeoutException {
		if (args.length == 0)
			System.err.println("supply FT1.2 communication port identifier");
		else
			System.out.println(supportsCemi(args[0]));
	}

	public static boolean supportsCemi(final String portId)
			throws KNXException, InterruptedException, TimeoutException {
		try (var conn = new FT12Connection(portId)) {
			final var cemi = new CompletableFuture<Boolean>();
			conn.addConnectionListener(frameEvent -> {
				final var frame = frameEvent.getFrameBytes();
				if ((frame[0] & 0xff) == peiIdentifyCon) {
					// PEI_identify.con is 9 bytes, Weinzierl cEMI support is indicated by 2 extra bytes
					cemi.complete(frame.length == 11);
				}
			});

			conn.send(new byte[] { (byte) peiIdentifyReq }, BlockingMode.NonBlocking);
			return cemi.get(1, TimeUnit.SECONDS);
		}
		catch (final ExecutionException na) { throw new AssertionError(); }
	}
}

from calimero-core.

holgerfriedrich avatar holgerfriedrich commented on August 30, 2024

Thank you @bmalinowsky, I will check if I can make use of this.

from calimero-core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.