Jump to content
View in the app

A better way to browse. Learn more.

Tinkerunity

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[Java] Bricklets am zweiten Masterbrick nicht im EnumerateListener

Featured Replies

Geschrieben

Hallo,

 

habe seit kurzem einen zweiten Masterbrick im Stack, an dann ein Ambientlight-Sensor hängt. Über den BrickViewer bekomme ich sowohl Masterbrick als auch Bricklet angezeigt. Soweit so gut.

 

Verbinde ich mich allerdings per Java-API mit Stack und registriere einen EmunerateListener erscheint weder der zweite Masterbrick noch das Bricklet. Das müsste doch eigentlich funktionieren, oder?

 

tinkerforgeConnection.addEnumerateListener(new EnumerateListener() {

@Override
public void enumerate(String uid, String connectedUid, char position,
					short[] hardwareVersion, short[] firmwareVersion,
					int deviceIdentifier, short enumerationType) {
	System.out.println("try to add bricklet with uid '" + uid + "'");
}
}

 

Gruß,

 

Thomas E.-E.

Geschrieben
  • Autor

nein :-[

 

Ich habe bisher einfach zunächst das connect() und dann das addEnumListener aufgerufen, danach ging es dann auch direkt los. Aber die ersten Devices hatte ich dann wohl schon verpasst.

 

Nun, rufe ich ipcon.enumerate() nochmal extra auf und damit funktioniert alles.

 

Problem ist nun, dass ich mit doppelten Device-UID umgehen muss. Das kriege ich aber hin ;-)

 

Danke für die schnelle Antwort!

 

Gruß,

 

Thomas E.-E.

 

Geschrieben
  • Autor

hmm ... habe den Code nochmal so geändert, dass der Listener vor dem Aufruf von ipconn.connect() registriert wird. Trotzdem erscheint der zweite MasterB nicht. Unabhängig davon, dass es mit enumerate() funktioniert, würde ich erwarten, dass ich so ebenfalls alle Bricks und Bricklets zu sehen bekomme, oder?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Gast
Reply to this topic...

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.