Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OnCapabilitiesRecieved Missing #33

Closed
MarinaMatore opened this issue Jul 13, 2019 · 4 comments
Closed

OnCapabilitiesRecieved Missing #33

MarinaMatore opened this issue Jul 13, 2019 · 4 comments

Comments

@MarinaMatore
Copy link

We need a callback when mFirmata.sendMessage(REQUEST_CAPABILITY); finishes.
Or when the pin list gets filled.

Or did I miss it somewhere?

Kind Regards

@kurbatov
Copy link
Owner

Hi Marina,

You can achieve this using low-level message handlers:

    IODevice device = new FirmataDevice(port);
    device.addProtocolMessageHandler(FirmataEventType.PIN_CAPABILITIES_MESSAGE, new Consumer<Event>() {
        @Override
        public void accept(Event evt) {
            //do the stuff here
        }
    });
    device.start();

That will basically add another handler to already registered one which you amend in #34. Since additional delay is required only for Adafruit Feather 32u4 board, I beleive it would be better to handle delays in such an additional handler.

@kurbatov
Copy link
Owner

kurbatov commented Jul 15, 2019

On the second thought the original design with delays is poorly implemented anyway. I think that all the pin state requests should be queued and sent only when response for the previous one is received. This approach yields robust and performant solution.

I beleive the primary handler should be redisigned because this exact place generates new issues with noticable frequency.

@MarinaMatore
Copy link
Author

MarinaMatore commented Aug 10, 2019

Hey @kurbatov !

When will your latest commit be available via Android gradle? Currently I still get the old commit.

Currently using: implementation 'com.github.kurbatov:firmata4j:2.3.7'

Thanks
Best wishes.

@kurbatov
Copy link
Owner

kurbatov commented Aug 26, 2019

Hi @MarinaMatore

I have released 2.3.8 which contains update of pin initialization. Besides of that it contains a new event type PIN_CAPABILITIES_FINISHED that can be used in a low-level message handler as described above.

The new release will be available soon via Maven Central.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants