def create_from_bytearray(data):
        offset = 0
        n_recording_regions, \
            buffering_out_fsm_state = struct.unpack_from(
                "<II", data, offset)
        offset += 8

        list_channel_buffer_state = list()
        for _ in xrange(n_recording_regions):
            entry = ChannelBufferState.create_from_bytearray(data, offset)
            offset += ChannelBufferState.size_of_channel_state()
            list_channel_buffer_state.append(entry)
        final_state = EndBufferingState(n_recording_regions,
                                        buffering_out_fsm_state,
                                        list_channel_buffer_state)
        return final_state
    def create_from_bytearray(data):
        offset = 0
        n_recording_regions, \
            buffering_out_fsm_state = struct.unpack_from(
                "<II", data, offset)
        offset += 8

        list_channel_buffer_state = list()
        for _ in xrange(n_recording_regions):
            entry = ChannelBufferState.create_from_bytearray(
                data, offset)
            offset += ChannelBufferState.size_of_channel_state()
            list_channel_buffer_state.append(entry)
        final_state = EndBufferingState(
            n_recording_regions, buffering_out_fsm_state,
            list_channel_buffer_state)
        return final_state
 def size_of_region(n_regions_to_record):
     size_of_header = 8 + 4 * n_regions_to_record
     size_of_channel_state = ChannelBufferState.size_of_channel_state()
     return size_of_header + n_regions_to_record * size_of_channel_state
 def size_of_region(n_regions_to_record):
     size_of_header = 8 + 4 * n_regions_to_record
     size_of_channel_state = ChannelBufferState.size_of_channel_state()
     return size_of_header + n_regions_to_record * size_of_channel_state