Device::Firmata::Protocol - Firmata protocol implementation
Implementation of the Firmata 2.5 protocol specification.
Because we're dealing with a permutation of the MIDI protocol, certain commands are one byte, others 2 or even 3. We do this part to figure out how many bytes we're actually looking at
One of the first things to know is that while MIDI is packet based, the bytes have specialized construction (where the top-most bit has been reserved to differentiate if it's a command or a data bit)
So any byte being transferred in a MIDI stream will look like the following
BIT# | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | DATA | X | ? | ? | ? | ? | ? | ? | ? |
If X is a "1" this byte is considered a command byte If X is a "0" this byte is considered a data bte
We figure out how many bytes a packet is by looking at the command byte and of that byte, only the high nibble. This nibble tells us the requisite information via a lookup table...
See: http://www.midi.org/techspecs/midimessages.php And http://www.ccarh.org/courses/253/handout/midiprotocol/ For more information
Basically, however:
command nibble bytes 8 2 9 2 A 2 B 2 C 1 D 1 E 2 F 0 or variable
Receive a string of data. Normally, only one byte is passed due to the code, but you can also pass as many bytes in a string as you'd like.
Takes the sysex data buffer and parses it into something useful
Using the midi protocol, create a binary packet that can be transmitted to the serial output
create a binary packet containing a sysex-message
create a binary packet containing a sysex-command
Craft a firmware version query packet to be sent
Craft a firmware variant query packet to be sent
Search list of implemented protocols for identical or next lower version.
To install Device::Firmata, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Device::Firmata
CPAN shell
perl -MCPAN -e shell install Device::Firmata
For more information on module installation, please visit the detailed CPAN module installation guide.