public static List < HidReport > create ( final KnxTunnelEmi emi , final byte [ ] frame ) { final List < HidReport > l = new ArrayList <> ( ) ; final EnumSet < PacketType > packetType = EnumSet . of ( PacketType . Start ) ; int maxData = maxDataStartPacket ; if ( frame . length > maxData ) packetType . add ( PacketType . Partial ) ; int offset = 0 ; for ( int i = 1 ; i < 6 ; i ++ ) { final int to = Math . min ( frame . length , offset + maxData ) ; final byte [ ] range = Arrays . copyOfRange ( frame , offset , to ) ; offset = to ; if ( offset >= frame . length ) packetType . add ( PacketType . End ) ; l . add ( new HidReport ( i , packetType . clone ( ) , Protocol . KnxTunnel , emi , noEmiMsgCode , range ) ) ; if ( offset >= frame . length ) break ; packetType . remove ( PacketType . Start ) ; maxData = maxDataPartialPacket ; } return l ; }
Creates a new report containing an EMI frame .