Class StreamHelper

    • Constructor Detail

      • StreamHelper

        StreamHelper()
    • Method Detail

      • bitstreamToDurations

         static List<Integer> bitstreamToDurations(String bitstream, int samplingRate)

        Return a list of durations(in µs) and the first duration is the duration of a 1, not a 0

      • numberOfBitsInDuration

         static int numberOfBitsInDuration(int duration, int durationBit, double tolerance)

        Compute the number of bits in a duration, knowing the duration of 1 bit and a tolerance

      • reconstructRealBitstream

         static String reconstructRealBitstream(List<Integer> durations, int durationBit0, int durationBit1, double tolerance)

        Reconstruct a bitstream from a list of durations to the real datarate knowing the duration of the bits and a tolerance

      • splitInCodewords

         static List<List<Integer>> splitInCodewords(List<Integer> durations, int splitDuration)

        Method to split a list of durations in a list of codeword (a codeword is a list of duration also)

        Parameters:
        durations - List of durations
        splitDuration - Minimum duration between 2 codewords
      • convertDurationsUnsigned2Signed

         static void convertDurationsUnsigned2Signed(boolean firstPolarity, List<Integer> durations)

        Convert an array of unsigned pulses to signed pulses the input is alterated by the method !! with a first polarity positive: [50, 100, 50, 100, 250] Result: [50, -100, 50, -100, 250]

      • convertDurationsUnsigned2Signed

         static String convertDurationsUnsigned2Signed(String durations, String separator)

        Convert a string which contains a suit of unsigned pulses to a string with signed pulses We consider that the first pulse is positive

      • convertLegacyRxDurationBytes2Integer

         static RfDurations convertLegacyRxDurationBytes2Integer(Array<byte> bufferPulseWidths)
        Parameters:
        bufferPulseWidths - 16 bits unsigned Pulse widths [Low byte first, high byte, Low byte, high byte, ...
        Returns:

        RfDurations

      • convertRxDurationBytes2Integer

         static RfDurations convertRxDurationBytes2Integer(Array<byte> bufferPulseWidths)
        Parameters:
        bufferPulseWidths - 16 bits signed Pulse widths [Low byte first, high byte, Low byte, high byte, ...
        Returns:

        RfDurations

      • concatenateDurations

         static List<Integer> concatenateDurations(List<Integer> durations)

        Return a new array, concatenated all consecutive pulses with the same polarity. Input: [-1, -1, +2, -1, +2, -1, 5, 5, 5, -3] Will return [-2, +2, -1, +2, -1, 15, -3]

      • removeGlitchsIfNeeded

         static StreamHelper.GlitchRemovingResult removeGlitchsIfNeeded(List<Integer> durations)

        Remove glitchs hosted in given durations list. Check unittests to see all supported cases. Example: [200] -> [200] [25] -> [25] [] -> [] [500, 250, 50, 100, 550, 400] -> [500, 400, 550, 400] [ +, -, +, -, +, -] -> [ +, -, +, -] [500, 500, 50, 025, 100, 100] -> [500, 675, 100] -> [500, 775] [ +, -, +, -, +, -] [ +, -, -] [ +, -]

      • isGlitch

         static boolean isGlitch(int duration)
      • isBigPulse

         static boolean isBigPulse(int pulse)