dxp 3-0
/home/epics/devel/areaDetector/ADApp/ADSrc/asynNDArrayDriver.h
Go to the documentation of this file.
00001 #ifndef asynNDArrayDriver_H
00002 #define asynNDArrayDriver_H
00003 
00004 #include "asynPortDriver.h"
00005 #include "NDArray.h"
00006 
00008 #define MAX_FILENAME_LEN 256
00009 
00011 typedef enum {
00012     NDFileModeSingle,       
00013     NDFileModeCapture,      
00015     NDFileModeStream        
00016 } NDFileMode_t;
00017 
00018 
00023  /*                               String                 asyn interface  access   Description  */
00024 #define NDPortNameSelfString    "PORT_NAME_SELF"    
00026     /* Parameters defining characteristics of the array data from the detector.
00027      * NDArraySizeX and NDArraySizeY are the actual dimensions of the array data,
00028      * including effects of the region definition and binning */
00029 #define NDArraySizeXString      "ARRAY_SIZE_X"      
00030 #define NDArraySizeYString      "ARRAY_SIZE_Y"      
00031 #define NDArraySizeZString      "ARRAY_SIZE_Z"      
00032 #define NDArraySizeString       "ARRAY_SIZE"        
00033 #define NDNDimensionsString     "ARRAY_NDIMENSIONS" 
00034 #define NDDimensionsString      "ARRAY_DIMENSIONS"  
00035 #define NDDataTypeString        "DATA_TYPE"         
00036 #define NDColorModeString       "COLOR_MODE"        
00037 #define NDUniqueIdString        "UNIQUE_ID"         
00038 #define NDTimeStampString       "TIME_STAMP"        
00039 #define NDBayerPatternString    "BAYER_PATTERN"     
00041     /* Statistics on number of arrays collected */
00042 #define NDArrayCounterString    "ARRAY_COUNTER"     
00044     /* File name related parameters for saving data.
00045      * Drivers are not required to implement file saving, but if they do these parameters
00046      * should be used.
00047      * The driver will normally combine NDFilePath, NDFileName, and NDFileNumber into
00048      * a file name that order using the format specification in NDFileTemplate.
00049      * For example NDFileTemplate might be "%s%s_%d.tif" */
00050 #define NDFilePathString        "FILE_PATH"         
00051 #define NDFilePathExistsString  "FILE_PATH_EXISTS"  
00052 #define NDFileNameString        "FILE_NAME"         
00053 #define NDFileNumberString      "FILE_NUMBER"       
00054 #define NDFileTemplateString    "FILE_TEMPLATE"     
00055 #define NDAutoIncrementString   "AUTO_INCREMENT"    
00056 #define NDFullFileNameString    "FULL_FILE_NAME"    
00057 #define NDFileFormatString      "FILE_FORMAT"       
00058 #define NDAutoSaveString        "AUTO_SAVE"         
00059 #define NDWriteFileString       "WRITE_FILE"        
00060 #define NDReadFileString        "READ_FILE"         
00061 #define NDFileWriteModeString   "WRITE_MODE"        
00062 #define NDFileNumCaptureString  "NUM_CAPTURE"       
00063 #define NDFileNumCapturedString "NUM_CAPTURED"      
00064 #define NDFileCaptureString     "CAPTURE"           
00066 #define NDFileDeleteDriverFileString  "DELETE_DRIVER_FILE"  
00069 #define NDAttributesFileString  "ND_ATTRIBUTES_FILE" 
00071     /* The detector array data */
00072 #define NDArrayDataString       "ARRAY_DATA"        
00073 #define NDArrayCallbacksString  "ARRAY_CALLBACKS"   
00080 class epicsShareFunc asynNDArrayDriver : public asynPortDriver {
00081 public:
00082     asynNDArrayDriver(const char *portName, int maxAddr, int numParams, int maxBuffers, size_t maxMemory,
00083                       int interfaceMask, int interruptMask,
00084                       int asynFlags, int autoConnect, int priority, int stackSize);
00085 
00086     /* These are the methods that we override from asynPortDriver */
00087     virtual asynStatus writeOctet(asynUser *pasynUser, const char *value, size_t maxChars,
00088                           size_t *nActual);
00089     virtual asynStatus readGenericPointer(asynUser *pasynUser, void *genericPointer);
00090     virtual asynStatus writeGenericPointer(asynUser *pasynUser, void *genericPointer);
00091     virtual void report(FILE *fp, int details);
00092 
00093     /* These are the methods that are new to this class */
00094     virtual int checkPath();
00095     virtual int createFileName(int maxChars, char *fullFileName);
00096     virtual int createFileName(int maxChars, char *filePath, char *fileName);
00097     virtual int readNDAttributesFile(const char *fileName);
00098     virtual int getAttributes(NDAttributeList *pAttributeList);
00099 
00100 protected:
00101     int NDPortNameSelf;
00102     #define FIRST_NDARRAY_PARAM NDPortNameSelf
00103     int NDArraySizeX;
00104     int NDArraySizeY;
00105     int NDArraySizeZ;
00106     int NDArraySize;
00107     int NDNDimensions;
00108     int NDDimensions;
00109     int NDDataType;
00110     int NDColorMode;
00111     int NDUniqueId;
00112     int NDTimeStamp;
00113     int NDBayerPattern;
00114     int NDArrayCounter;
00115     int NDFilePath;
00116     int NDFilePathExists;
00117     int NDFileName;
00118     int NDFileNumber;
00119     int NDFileTemplate;
00120     int NDAutoIncrement;
00121     int NDFullFileName;
00122     int NDFileFormat;
00123     int NDAutoSave;
00124     int NDWriteFile;
00125     int NDReadFile;
00126     int NDFileWriteMode;
00127     int NDFileNumCapture;
00128     int NDFileNumCaptured;
00129     int NDFileCapture;   
00130     int NDFileDeleteDriverFile;
00131     int NDAttributesFile;
00132     int NDArrayData;
00133     int NDArrayCallbacks;
00134     #define LAST_NDARRAY_PARAM NDArrayCallbacks
00135 
00136     NDArray **pArrays;             
00137     NDArrayPool *pNDArrayPool;     
00138     class NDAttributeList *pAttributeList;  
00140 };
00141 
00142 #define NUM_NDARRAY_PARAMS (&LAST_NDARRAY_PARAM - &FIRST_NDARRAY_PARAM + 1)
00143 #endif