dxp 3-4
|
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 typedef enum { 00019 NDFileWriteOK, 00020 NDFileWriteError 00021 } NDFileWriteStatus_t; 00022 00027 /* String asyn interface access Description */ 00028 #define NDPortNameSelfString "PORT_NAME_SELF" 00031 #define NDADCoreVersionString "ADCORE_VERSION" 00033 /* Parameters defining characteristics of the array data from the detector. 00034 * NDArraySizeX and NDArraySizeY are the actual dimensions of the array data, 00035 * including effects of the region definition and binning */ 00036 #define NDArraySizeXString "ARRAY_SIZE_X" 00037 #define NDArraySizeYString "ARRAY_SIZE_Y" 00038 #define NDArraySizeZString "ARRAY_SIZE_Z" 00039 #define NDArraySizeString "ARRAY_SIZE" 00040 #define NDNDimensionsString "ARRAY_NDIMENSIONS" 00041 #define NDDimensionsString "ARRAY_DIMENSIONS" 00042 #define NDDataTypeString "DATA_TYPE" 00043 #define NDColorModeString "COLOR_MODE" 00044 #define NDUniqueIdString "UNIQUE_ID" 00045 #define NDTimeStampString "TIME_STAMP" 00046 #define NDEpicsTSSecString "EPICS_TS_SEC" 00047 #define NDEpicsTSNsecString "EPICS_TS_NSEC" 00048 #define NDBayerPatternString "BAYER_PATTERN" 00050 /* Statistics on number of arrays collected */ 00051 #define NDArrayCounterString "ARRAY_COUNTER" 00053 /* File name related parameters for saving data. 00054 * Drivers are not required to implement file saving, but if they do these parameters 00055 * should be used. 00056 * The driver will normally combine NDFilePath, NDFileName, and NDFileNumber into 00057 * a file name that order using the format specification in NDFileTemplate. 00058 * For example NDFileTemplate might be "%s%s_%d.tif" */ 00059 #define NDFilePathString "FILE_PATH" 00060 #define NDFilePathExistsString "FILE_PATH_EXISTS" 00061 #define NDFileNameString "FILE_NAME" 00062 #define NDFileNumberString "FILE_NUMBER" 00063 #define NDFileTemplateString "FILE_TEMPLATE" 00064 #define NDAutoIncrementString "AUTO_INCREMENT" 00065 #define NDFullFileNameString "FULL_FILE_NAME" 00066 #define NDFileFormatString "FILE_FORMAT" 00067 #define NDAutoSaveString "AUTO_SAVE" 00068 #define NDWriteFileString "WRITE_FILE" 00069 #define NDReadFileString "READ_FILE" 00070 #define NDFileWriteModeString "WRITE_MODE" 00071 #define NDFileWriteStatusString "WRITE_STATUS" 00072 #define NDFileWriteMessageString "WRITE_MESSAGE" 00073 #define NDFileNumCaptureString "NUM_CAPTURE" 00074 #define NDFileNumCapturedString "NUM_CAPTURED" 00075 #define NDFileCaptureString "CAPTURE" 00076 #define NDFileDeleteDriverFileString "DELETE_DRIVER_FILE" 00077 #define NDFileLazyOpenString "FILE_LAZY_OPEN" 00078 #define NDFileCreateDirString "CREATE_DIR" 00079 #define NDFileTempSuffixString "FILE_TEMP_SUFFIX" 00081 #define NDAttributesFileString "ND_ATTRIBUTES_FILE" 00083 /* The detector array data */ 00084 #define NDArrayDataString "ARRAY_DATA" 00085 #define NDArrayCallbacksString "ARRAY_CALLBACKS" 00087 /* NDArray Pool status */ 00088 #define NDPoolMaxBuffersString "POOL_MAX_BUFFERS" 00089 #define NDPoolAllocBuffersString "POOL_ALLOC_BUFFERS" 00090 #define NDPoolFreeBuffersString "POOL_FREE_BUFFERS" 00091 #define NDPoolMaxMemoryString "POOL_MAX_MEMORY" 00092 #define NDPoolUsedMemoryString "POOL_USED_MEMORY" 00093 00099 class epicsShareFunc asynNDArrayDriver : public asynPortDriver { 00100 public: 00101 asynNDArrayDriver(const char *portName, int maxAddr, int numParams, int maxBuffers, size_t maxMemory, 00102 int interfaceMask, int interruptMask, 00103 int asynFlags, int autoConnect, int priority, int stackSize); 00104 virtual ~asynNDArrayDriver(); 00105 /* These are the methods that we override from asynPortDriver */ 00106 virtual asynStatus writeOctet(asynUser *pasynUser, const char *value, size_t maxChars, 00107 size_t *nActual); 00108 virtual asynStatus readGenericPointer(asynUser *pasynUser, void *genericPointer); 00109 virtual asynStatus writeGenericPointer(asynUser *pasynUser, void *genericPointer); 00110 virtual asynStatus readInt32(asynUser *pasynUser, epicsInt32 *value); 00111 virtual asynStatus readFloat64(asynUser *pasynUser, epicsFloat64 *value); 00112 virtual void report(FILE *fp, int details); 00113 00114 /* These are the methods that are new to this class */ 00115 virtual asynStatus createFilePath(const char *path, int pathDepth); 00116 virtual asynStatus checkPath(); 00117 virtual asynStatus createFileName(int maxChars, char *fullFileName); 00118 virtual asynStatus createFileName(int maxChars, char *filePath, char *fileName); 00119 virtual asynStatus readNDAttributesFile(const char *fileName); 00120 virtual asynStatus getAttributes(NDAttributeList *pAttributeList); 00121 00122 protected: 00123 int NDPortNameSelf; 00124 #define FIRST_NDARRAY_PARAM NDPortNameSelf 00125 int NDADCoreVersion; 00126 int NDArraySizeX; 00127 int NDArraySizeY; 00128 int NDArraySizeZ; 00129 int NDArraySize; 00130 int NDNDimensions; 00131 int NDDimensions; 00132 int NDDataType; 00133 int NDColorMode; 00134 int NDUniqueId; 00135 int NDTimeStamp; 00136 int NDEpicsTSSec; 00137 int NDEpicsTSNsec; 00138 int NDBayerPattern; 00139 int NDArrayCounter; 00140 int NDFilePath; 00141 int NDFilePathExists; 00142 int NDFileName; 00143 int NDFileNumber; 00144 int NDFileTemplate; 00145 int NDAutoIncrement; 00146 int NDFullFileName; 00147 int NDFileFormat; 00148 int NDAutoSave; 00149 int NDWriteFile; 00150 int NDReadFile; 00151 int NDFileWriteMode; 00152 int NDFileWriteStatus; 00153 int NDFileWriteMessage; 00154 int NDFileNumCapture; 00155 int NDFileNumCaptured; 00156 int NDFileCapture; 00157 int NDFileDeleteDriverFile; 00158 int NDFileLazyOpen; 00159 int NDFileCreateDir; 00160 int NDFileTempSuffix; 00161 int NDAttributesFile; 00162 int NDArrayData; 00163 int NDArrayCallbacks; 00164 int NDPoolMaxBuffers; 00165 int NDPoolAllocBuffers; 00166 int NDPoolFreeBuffers; 00167 int NDPoolMaxMemory; 00168 int NDPoolUsedMemory; 00169 #define LAST_NDARRAY_PARAM NDPoolUsedMemory 00170 00171 NDArray **pArrays; 00172 NDArrayPool *pNDArrayPool; 00173 class NDAttributeList *pAttributeList; 00175 }; 00176 00177 #define NUM_NDARRAY_PARAMS ((int)(&LAST_NDARRAY_PARAM - &FIRST_NDARRAY_PARAM + 1)) 00178 #endif