(
            self, sample_interval, callback_method)
Registers a callback function to receive an event when the specified
        number of samples is written from the buffer to the device. This
        function only works with devices that support buffered tasks.

        When you stop a task explicitly any pending events are discarded. For
        example, if you call DAQmx Stop Task then you do not receive any
        pending events.

        Args:
            sample_interval (int): Specifies the number of samples after
                which each event should occur.
            callback_method (function): Specifies the function that you want
                DAQmx to call when the event occurs. The function you pass in
                this parameter must have the following prototype:

                >>> def callback(task_handle, every_n_samples_event_type,
                >>>         number_of_samples, callback_data):
                >>>     return 0

                Upon entry to the callback, the task_handle parameter contains
                the handle to the task on which the event occurred. The
                every_n_samples_event_type parameter contains the
                EveryNSamplesEventType.TRANSFERRED_FROM_BUFFER value. The
                number_of_samples parameter contains the value you passed in
                the sample_interval parameter of this function. The
                callback_data parameter contains the value you passed in the
                callback_data parameter of this function.

                Passing None for this parameter unregisters the event callback
                function.
Registers a callback function to receive an event when the specified
        number of samples is written from the buffer to the device. This
        function only works with devices that support buffered tasks.
Registers a callback function to receive an event when the specified number of samples is written from the buffer to the device . This function only works with devices that support buffered tasks .
def register_every_n_samples_transferred_from_buffer_event(
            self, sample_interval, callback_method):
        """
        Registers a callback function to receive an event when the specified
        number of samples is written from the buffer to the device. This
        function only works with devices that support buffered tasks.

        When you stop a task explicitly any pending events are discarded. For
        example, if you call DAQmx Stop Task then you do not receive any
        pending events.

        Args:
            sample_interval (int): Specifies the number of samples after
                which each event should occur.
            callback_method (function): Specifies the function that you want
                DAQmx to call when the event occurs. The function you pass in
                this parameter must have the following prototype:

                >>> def callback(task_handle, every_n_samples_event_type,
                >>>         number_of_samples, callback_data):
                >>>     return 0

                Upon entry to the callback, the task_handle parameter contains
                the handle to the task on which the event occurred. The
                every_n_samples_event_type parameter contains the
                EveryNSamplesEventType.TRANSFERRED_FROM_BUFFER value. The
                number_of_samples parameter contains the value you passed in
                the sample_interval parameter of this function. The
                callback_data parameter contains the value you passed in the
                callback_data parameter of this function.

                Passing None for this parameter unregisters the event callback
                function.
        """
        DAQmxEveryNSamplesEventCallbackPtr = ctypes.CFUNCTYPE(
            ctypes.c_int32, lib_importer.task_handle, ctypes.c_int32,
            ctypes.c_uint32, ctypes.c_void_p)

        cfunc = lib_importer.windll.DAQmxRegisterEveryNSamplesEvent

        with cfunc.arglock:
            if callback_method is not None:
                callback_method_ptr = DAQmxEveryNSamplesEventCallbackPtr(
                    callback_method)
                self._every_n_transferred_event_callbacks.append(
                    callback_method_ptr)
                cfunc.argtypes = [
                    lib_importer.task_handle, ctypes.c_int, ctypes.c_uint,
                    ctypes.c_uint, DAQmxEveryNSamplesEventCallbackPtr,
                    ctypes.c_void_p]
            else:
                del self._every_n_transferred_event_callbacks[:]
                callback_method_ptr = None
                cfunc.argtypes = [
                    lib_importer.task_handle, ctypes.c_int, ctypes.c_uint,
                    ctypes.c_uint, ctypes.c_void_p, ctypes.c_void_p]

            error_code = cfunc(
                self._handle,
                EveryNSamplesEventType.TRANSFERRED_FROM_BUFFER.value,
                sample_interval, 0, callback_method_ptr, None)
        check_for_error(error_code)
def register_every_n_samples_transferred_from_buffer_event ( self , sample_interval , callback_method ) : DAQmxEveryNSamplesEventCallbackPtr = ctypes . CFUNCTYPE ( ctypes . c_int32 , lib_importer . task_handle , ctypes . c_int32 , ctypes . c_uint32 , ctypes . c_void_p ) cfunc = lib_importer . windll . DAQmxRegisterEveryNSamplesEvent with cfunc . arglock : if callback_method is not None : callback_method_ptr = DAQmxEveryNSamplesEventCallbackPtr ( callback_method ) self . _every_n_transferred_event_callbacks . append ( callback_method_ptr ) cfunc . argtypes = [ lib_importer . task_handle , ctypes . c_int , ctypes . c_uint , ctypes . c_uint , DAQmxEveryNSamplesEventCallbackPtr , ctypes . c_void_p ] else : del self . _every_n_transferred_event_callbacks [ : ] callback_method_ptr = None cfunc . argtypes = [ lib_importer . task_handle , ctypes . c_int , ctypes . c_uint , ctypes . c_uint , ctypes . c_void_p , ctypes . c_void_p ] error_code = cfunc ( self . _handle , EveryNSamplesEventType . TRANSFERRED_FROM_BUFFER . value , sample_interval , 0 , callback_method_ptr , None ) check_for_error ( error_code )