Пример #1
0
                WINDOW_OVERLAP, SAMPLING_FREQ, ring_event,
                ring_queue)  # thread 2: filter, extract features, classify

            thread_process_classification.start()  # start thread 2

            buffer_leftover = []
            while process_obj.input_GPIO():
                buffer_read = tcp_ip_sylph.read(buffer_leftover)
                buffer_leftover, empty_buffer_flag = data_obj.get_buffer(
                    buffer_read)
                if not empty_buffer_flag:
                    data_obj.get_data_channel(
                    )  # demultiplex and get the channel data
                    # print(data_obj.data_processed[-1, -1])
                    # data_obj.save(data_obj.data_processed, "a")
                    data_obj.fill_ring_data(ring_queue)  # fill the ring buffer

            ring_event.clear()

            tcp_ip_sylph.write_disconnect()
            # tcp_ip_odin.write_disconnect()  # write 16 char to odin socket
            tcp_ip_sylph.close()
            tcp_ip_odin.close()

            thread_process_classification.join()  # terminate thread 2

            print('ring event cleared...')
        else:
            print('Main waiting for connection: %d...' % count)
            count += 1
            sleep(3)