def stop_callback(task_handle, every_n_samples_event_type, number_of_samples, callback_data): """A nidaqmx callback that wrapps, reads and stops""" global callback, nsamples global do_return, nsamples_each, nsamples_acquired global ntimes, message global each_signal, signal nsamples_acquired = ntimes * nsamples_each if nsamples_acquired <= nsamples: each_signal = self.__read__(nsamples_each) callback(each_signal) if do_return: signal = utl.multiappend(signal, each_signal) ntimes += 1 self.__print__(message.format(ntimes)) else: raise KeyboardInterrupt # self.__task.control(task_states.TASK_STOP) return 0
def no_callback_w_stream(task_handle, every_n_samples_event_type, number_of_samples, callback_data): """A nidaqmx callback that just reads with read_streamers""" global do_return, nsamples_each global ntimes, message global each_signal, signal if do_return: each_signal = self.__stream_read__(nsamples_each, each_signal) signal = utl.multiappend(signal, each_signal) ntimes += 1 self.__print__(message.format(ntimes)) return 0
def arg_callback(task_handle, every_n_samples_event_type, number_of_samples, callback_data): """A nidaqmx callback that wrapps and reads""" global callback global do_return, nsamples_each global ntimes, message global each_signal, signal each_signal = self.__read__(nsamples_each) callback(each_signal) if do_return: signal = utl.multiappend(signal, each_signal) ntimes += 1 self.__print__(message.format(ntimes)) return 0