Jump to content

Update list of connected Bricklets


Recommended Posts

thank you for your answer!

I am not sure if we understood each other correctly:

My problem is, that the Master Brick is not informed when the connection to a bricklet (like the  US Distance bricklet) is interrupted.


I tried the


you suggested, I then diconnected the bricklet from the master brick but unfortunately the


function does still return sucessfully - which is a bit strange I think^^

Link to comment
Share on other sites



ok, right, it was a misunderstanding.

The listener I was talking about is for disconnects of the IP connection.

Actually, I don't know whether there's a listener/functionality to get informed about a disconnected bricklet.

What happens if you call "enumerate" after you disconnect the bricklet? It should not appear again.

What is your use case? I mean, normally, a bricklet shouldn't get disconnected by accident. The cable must actively be removed.

Link to comment
Share on other sites

My use case is the following:

I am running a self-test after startup which compares all bricklets defined in a config-file to those which are connected.

If one is not connected, then the user sees some kind of error-message, the application waits until the user plugs in the missing device and continues to check the next one.

Link to comment
Share on other sites


If have three problems now:


1) How do I know if all bricklets have already called the callback yet? How long do I have to wait at worst?


2) Do I need mutual exclusion inside the callbacks? (Or is it guaranteed that they are invoked one by one)?


3) Looks like the bricklets-list is not updated anymore after booting up, you can even disconnect a bricklet - the corresponing callback is still invoked when calling





Link to comment
Share on other sites

Hi flodo,


i.e., you just check at startup time and you don't need to check once the system is up and running? --> Only "periodic" check at startup required until "all" bricklets are checked?

Regarding 1)

Good question. In my case, I know which bricklets are connected and I wait until all of them have sent a call/event for the enumeration. I think if you wait 100ms per bricklet, that should be enough (if time doesn't matter, I would wait even longer). But maybe that should answer someone from TF.

Regarding 2)

You don't need mutual exclusion. You will have only one call at a time.

Regarding 3)

Hmm, right, that's possible :-( As far as I know, the bricklets are not hot-plug capable. That would mean that you cannot detect added or removed bricklets after startup. But I think someone from TF should confirm that.

Link to comment
Share on other sites

  • 3 weeks later...

flodo, what you're trying to do is called hotplug, this is not supported. Therefore, there is no API to detect it. You cannot connect/disconnect Bricklets while a Brick is powered/running.


What you can do is check if the required Bricklets are connected using the enumerate mechanism. If some are missing advise the user to disconnect the Brick from power, connect the required Bricklets and the power the Brick again.

Link to comment
Share on other sites

Join the conversation

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

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...