The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Device::Firmata::Protocol - details of the actual firmata protocol

DESCRIPTION

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

message_data_receive

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.

sysex_parse

Takes the sysex data buffer and parses it into something useful

message_prepare

Using the midi protocol, create a binary packet that can be transmitted to the serial output

packet_sysex

create a binary packet containing a sysex-message

packet_sysex_command

create a binary packet containing a sysex-command

packet_query_version

Craft a firmware version query packet to be sent

packet_query_firmware

Craft a firmware variant query packet to be sent

get_max_compatible_protocol_version

Search list of implemented protocols for identical or next lower version.