thunderbird Posted March 10, 2012 at 01:16 PM Share Posted March 10, 2012 at 01:16 PM Hallo, gibt es eine Möglichkeit in einem Listener an die UID des auslösenden Bricklets zu kommen ? Ich würde den Messwert gerne an eine queue weitergeben damit ich aber nachher identifizieren kann aus welchem Sensor das ganze stammt würde ich gerne die UID mitgeben. temp.addListener(new BrickletTemperature.TemperatureListener() { public void temperature(short temperature) { messwert m = new messwert(); m.setSensor(null); m.setTime(new Timestamp(System.currentTimeMillis())); m.setWert(temperature / 100.0f); queue.put(m); } }); Quote Link to comment Share on other sites More sharing options...
borg Posted March 10, 2012 at 03:08 PM Share Posted March 10, 2012 at 03:08 PM Öh, könntest du nicht sowas machen: public static void addTempListener(final String name, BrickletTemperature temp) { temp.addListener(new BrickletTemperature.TemperatureListener() { private final String temp_name = name; public void temperature(short temperature) { messwert m = new messwert(); m.setSensor(null); m.setTime(new Timestamp(System.currentTimeMillis())); m.setWert(temperature / 100.0f); queue.put(m); System.out.println("name: " + temp_name); System.out.println("Temperature: " + temperature/100.0 + " °C"); } }); } und dann aufrufen mit addTempListener("Sensor 1", temp1); addTempListener("Sensor 2", temp2); (ungetestet) Quote Link to comment Share on other sites More sharing options...
thunderbird Posted March 10, 2012 at 08:36 PM Author Share Posted March 10, 2012 at 08:36 PM Hört sich nach nem Plan an :-) Ich werds Montag sofort testen. Quote Link to comment Share on other sites More sharing options...
thunderbird Posted March 14, 2012 at 08:43 PM Author Share Posted March 14, 2012 at 08:43 PM Läuft super Danke :-) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.