Ejemplo n.º 1
0
            print "  interpolation: ", interpol_values
            print "  current sample: ", sample.channel_data
        # send to clients interpolated sample
        #leftover_duplications = 0
        server.broadcast_values(interpol_values)
        nb_samples_out = nb_samples_out + 1

    # send to clients current sample
    server.broadcast_values(sample.channel_data)
    nb_samples_out = nb_samples_out + 1

    # save current values for possible interpolation
    last_values = list(sample.channel_data)


if __name__ == '__main__':
    # init server
    #server = streamer_tcp_server.StreamerTCPServer(ip=SERVER_IP, port=SERVER_PORT, nb_channels=NB_CHANNELS)
    server = streamer_tcp_server.StreamerTCPServer(ip=SERVER_IP,
                                                   port=SERVER_PORT)
    # init board
    #port = '/dev/ttyUSB1'
    port = 'COM7'
    baud = 115200
    monit = Monitor()
    # daemonize theard to terminate it altogether with the main when time will come
    monit.daemon = True
    monit.start()
    board = bci.OpenBCIBoard(port=port, baud=baud, filter_data=False)
    board.startStreaming(streamData)
Ejemplo n.º 2
0
            print "  last values: ", last_values
            print "  interpolation: ", interpol_values
            print "  current sample: ", sample.channel_data
        # send to clients interpolated sample
        #leftover_duplications = 0
        server.broadcast_values(interpol_values)
        nb_samples_out = nb_samples_out + 1

    # send to clients current sample
    server.broadcast_values(sample.channel_data)
    nb_samples_out = nb_samples_out + 1

    # save current values for possible interpolation
    last_values = list(sample.channel_data)


if __name__ == '__main__':
    # init server
    server = streamer_tcp_server.StreamerTCPServer(ip=SERVER_IP,
                                                   port=SERVER_PORT,
                                                   nb_channels=NB_CHANNELS)
    # init board
    port = '/dev/ttyUSB0'
    baud = 115200
    monit = Monitor()
    # daemonize theard to terminate it altogether with the main when time will come
    monit.daemon = True
    monit.start()
    board = bci.OpenBCIBoard(port=port, baud=baud, filter_data=False)
    board.startStreaming(streamData)