<<  

All hardware driver classes are descendants from SDevice class. All functions discussed in this section are virtual functions of SDevice class.

To add new functionality to the driver one need to override virtual functions. In some cases one have to keep functionality of base class by direct call of base class functions.

Driver has 5 group of functions

Driver information

Function

Description

Info

Used by GUI to provide information about device state and functionality.

GetDirectControls

Override this function if driver has a user interface.

Driver configuration

Function

Description

StartSetup

Starting device preparation for the new experiment. Calling of base function is necessary.

ConnectAcquisition

Appears in between of StartSetup and EndSetup function. Defines acquisition streams, their type and size. Cause asynchronous read properties to start data reading. Base function makes assignment of acquisition streams to device properties and thus has to be called.

EndSetup

Finishing device preparation to the new experiment.

Reset

Clean up procedure. Base function has to be called.

These functions may be overridden only if device has properties. Although in most cases the functionality of base class is sufficient.

Input/output

Function

Description

SetProperty

Do additional action during posting command to the queue. Base function may be called. Write to device action caused by SetProperty have to be executed immediately.

SetAsyncProperty

All points will be sent by consequent calls to this function at one time. Device can stores them to array of values to use later. No immediate execution of any point setup is expected. SetProperty uses as a synchronization (value of parameter in SetProperty will be anyway correct). Used for information to let device know the whole range of data or if all data have to be programmed at one time.

GetProperty

Do additional action during posting command to the queue. Base function may be called. Read from device action caused by GetProperty have to be executed immediately.

SyncRead

Inform device that data acquisition can be started. When data acquisition will finish IsDataReady have to return positive result. Actual reading can be started later by any internal or external cause typically by external trigger.

SyncRead function is always called from transient axis. Amount of point of point expected to set after function is TransientSize in a case of Transient and 1 in a case of Integrated options.

IsDataReady

Confirm receiving of data.

These functions have to be override only if device has pulse capabilities

Pulse functions

Function

Description

StartOfProgramming

Beginning of pulse sequence programming. Base function has to be called.

Pulse

Building of pulse sequence. No hardware programming may be done. Base function is checking the input and can be useful.

SetRepetitionTime

Appears just before EndOfProgramming . Override this function to do additional setup of repetition time. Base function may be called.

EndOfProgramming

Sequence hardware programming have to be done here.

Trigger

Allow device to start pulsing or receive external trigger.

DoExecute function executes in the separate thread independently from all other functions. Communication with this function is made using command queue.

Only one command at a time at the order of loading is executed. Internal SDevice class engine provide a support for command queue. Direct access to queue is forbidden.

All time consuming programming and actual hardware access have to be done in DoExecute function.

This allow to keep right sequence of commands and allow program execute all time consuming processes simultaneously.

Execution

Function

Description

DoExecute

The only function that executes inside device thread. Do here all procedures that have to be run in parallel to other threads.


<<