Skip to content

Missing example of handlers - migrating to 2.2? #12

@cefn

Description

@cefn

I think I understand the way that handlers are bound to Firmata events (via add_cmd_handler) but I'm flummoxed how to tell what kind of structure my handler function should have so that introspection serves out arguments correctly for a new command binding (beyond the analog and digital bindings you've already provided).

Are there examples or documentation I've missed, for example, detailing how to add a handler for an arbitrary string command, as sent from the Firmata function "sendString" ? If not, would it be possible to create an example or a note about how add_cmd_handler works/might work for the range of possible transmissions listed at...
http://www.firmata.org/wiki/V2.2ProtocolDetails
...or even...
http://www.firmata.org/wiki/V2.3ProtocolDetails

Is it simply about defining a function with a single named/unnamed byte argument per byte expected beyond the command byte, then unmarshalling them in ways which reflect the protocol?

I'm guessing that moving towards 2.2/2.3 is mainly about this kind of binding, but I don't know if there's a structural problem with the current code passing through the newer messages since 2.1. This might be another area which I can get to in coming months.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions