def main():
    zephyr.configure_root_logger()
    
    ser = TimedVirtualSerial(test_data_dir + "/120-second-bt-stream.dat",
                             test_data_dir + "/120-second-bt-stream-timing.csv")
    
    simulation_workflow([callback], ser)
def main():
    zephyr.configure_root_logger()
    
    collector = MeasurementCollector()
    rr_signal_analysis = BioHarnessSignalAnalysis([], [collector.handle_event])
    signal_packet_handlers = [collector.handle_signal, rr_signal_analysis.handle_signal]
    
    signal_packet_handler = BioHarnessPacketHandler(signal_packet_handlers, [collector.handle_event])
    
    payload_parser = MessagePayloadParser(signal_packet_handler.handle_packet)
    
    delayed_stream_thread = DelayedRealTimeStream(collector, callback)
    
    simulation_thread = FilePacketSimulator(test_data_dir + "/120-second-bt-stream.dat",
                                            test_data_dir + "/120-second-bt-stream-timing.csv",
                                            payload_parser.handle_message)
    
    delayed_stream_thread.start()
    simulation_thread.start()
    
    visualization = VisualizationWindow(collector)
    visualization.show()
    
    simulation_thread.terminate()
    simulation_thread.join()
    
    delayed_stream_thread.terminate()
    delayed_stream_thread.join()
Example #3
0
def simulation_workflow(callbacks, ser):
    zephyr.configure_root_logger()
    
    collector = MeasurementCollector()
    
    rr_signal_analysis = BioHarnessSignalAnalysis([], [collector.handle_event])

    signal_packet_handler_bh = BioHarnessPacketHandler([collector.handle_signal, rr_signal_analysis.handle_signal],
                                                       [collector.handle_event])
    signal_packet_handler_hxm = HxMPacketAnalysis([collector.handle_event])
    
    payload_parser = MessagePayloadParser([signal_packet_handler_bh.handle_packet,
                                           signal_packet_handler_hxm.handle_packet])
    
    delayed_stream_thread = DelayedRealTimeStream(collector, callbacks, 1.2)
    
    protocol = BioHarnessProtocol(ser, payload_parser.handle_message)
    protocol.enable_periodic_packets()
    
    delayed_stream_thread.start()
    
    try:
        protocol.run()
    except EOFError:
        pass
    
    delayed_stream_thread.terminate()
    delayed_stream_thread.join()
def simulation_workflow(callbacks, ser):
    zephyr.configure_root_logger()

    collector = MeasurementCollector()

    rr_signal_analysis = BioHarnessSignalAnalysis([], [collector.handle_event])

    signal_packet_handler_bh = BioHarnessPacketHandler(
        [collector.handle_signal, rr_signal_analysis.handle_signal],
        [collector.handle_event])
    signal_packet_handler_hxm = HxMPacketAnalysis([collector.handle_event])

    payload_parser = MessagePayloadParser([
        signal_packet_handler_bh.handle_packet,
        signal_packet_handler_hxm.handle_packet
    ])

    message_parser = MessageFrameParser(payload_parser.handle_message)

    delayed_stream_thread = DelayedRealTimeStream(collector, callbacks, 1.2)

    protocol = BioHarnessProtocol(ser, [message_parser.parse_data])
    print "Enabling packets"
    protocol.enable_periodic_packets()

    delayed_stream_thread.start()

    try:
        protocol.run()
    except EOFError:
        pass

    delayed_stream_thread.terminate()
    delayed_stream_thread.join()
Example #5
0
def main():
    zephyr.configure_root_logger()
    
    serial_port_dict = {"Darwin": "/dev/cu.BHBHT001931-iSerialPort1",
                        "Windows": 23}
    
    serial_port = serial_port_dict[platform.system()]
    ser = serial.Serial(serial_port)
    
    simulation_workflow([callback], ser)
Example #6
0
def main():
    zephyr.configure_root_logger()

    serial_port_dict = {"Darwin": "/dev/tty.HXM016473-BluetoothSeri",
                        "Windows": 23}

    serial_port = serial_port_dict[platform.system()]
    ser = serial.Serial(serial_port)

    simulation_workflow([callback], ser)
def main():
    zephyr.configure_root_logger()

    serial_port_dict = {
        "Darwin": "/dev/cu.BHBHT001931-iSerialPort1",
        "Windows": 23
    }

    serial_port = serial_port_dict[platform.system()]
    ser = serial.Serial(serial_port)

    simulation_workflow([callback], ser)
Example #8
0
def main():
    zephyr.configure_root_logger()

    serial_port_dict = {
        "Darwin": "/dev/tty.HXM016473-BluetoothSeri",
        "Windows": 23
    }

    serial_port = serial_port_dict[platform.system()]
    ser = serial.Serial(serial_port)

    simulation_workflow([callback], ser)
Example #9
0
def main():
    zephyr.configure_root_logger()
    
    analysis = HxMPacketAnalysis([callback])
    
    hxm_handler = MessagePayloadParser(analysis.handle_packet)
    
    simulation_thread = FilePacketSimulator(test_data_dir + "/120-second-bt-stream-hxm.dat",
                                            test_data_dir + "/120-second-bt-stream-hxm-timing.csv",
                                            hxm_handler.handle_message)
    
    simulation_thread.start()
    simulation_thread.join()
def main():
    zephyr.configure_root_logger()

    serial_port_dict = {
        "Darwin": "/dev/cu.BHBHT001931-iSerialPort1",
        "Windows": 23
    }

    serial_port = serial_port_dict[platform.system()]
    ser = serial.Serial(serial_port)

    zephyr.configure_root_logger()

    collector = MeasurementCollector()

    rr_signal_analysis = BioHarnessSignalAnalysis([], [collector.handle_event])

    signal_packet_handler_bh = BioHarnessPacketHandler(
        [collector.handle_signal, rr_signal_analysis.handle_signal],
        [collector.handle_event])

    payload_parser = MessagePayloadParser(
        [signal_packet_handler_bh.handle_packet])
    # payload_parser = MessagePayloadParser([signal_packet_handler_bh.handle_packet,
    # signal_packet_handler_hxm.handle_packet])

    message_parser = MessageFrameParser(payload_parser.handle_message)

    delayed_stream_thread = DelayedRealTimeStream(collector, callbacks, 1.2)
    # delayed_stream_thread = DelayedRealTimeStream(collector, callbacks, 1)

    protocol = BioHarnessProtocol(ser, [message_parser.parse_data])
    # protocol.enable_periodic_packets()
    protocol.enable_breathing_waveform()

    delayed_stream_thread.start()

    try:
        protocol.run()
    except EOFError:
        pass

    delayed_stream_thread.terminate()
    delayed_stream_thread.join()
Example #11
0
    def __init__( self ):
        QThread.__init__(self)
        self.prev_val = 0
        self.SerialNumber = ''
        self.connected = False
        self.paused = False
        self.running = False
        self.create_test_data = False
        self.PacketType = { 'GENERAL':0x14,
                            'BREATHING':0x15,
                            'ECG':0x16,
                            'RRDATA':0x19,
                            'ACC':0x1E,
                            'SUMMARY':0xBD,}
        
        self.virtual_serial = False

        zephyr.configure_root_logger()
        if CREATE_TEST_DATA is True and self.virtual_serial is False:
            self.testdata_writer = MessageDataLogger(test_data_dir + "/5-minutes-zephyr-stream-03")