The first byte (the command byte) has two parts, the first 4 bits (nibble) are the command which would be 9 or 8 or B (in hex) for note on, note off, and cc respectively.
The low order nibble is the MIDI channel 0-F.
So you need to do this.
Incoming: xx pp 7F
//mask lower nibble only looking for 0x80 or 0x90
// if you do the bitwise math either 0x8n or 0x90 will produce output of 0x80
// uncomment the below two line lines if you want only note-on or note off
// if rr!=0x80 then exit rules, skip outgoing action
// mask upper nibble
if rr>2 then exit rules, skip outgoing action
if rr<1 then exit rules, skip outgoing action
Bome Customer Care
Also available for paid consulting services: firstname.lastname@example.org