diff --git a/SchemasApp/Db/NDPluginSchemas.template b/SchemasApp/Db/NDPluginSchemas.template index 4bf0590f001d6837e373850ad932290e6e18b4f5..e5880330e7959cf0adc9bd3877c1cc23f82a0316 100644 --- a/SchemasApp/Db/NDPluginSchemas.template +++ b/SchemasApp/Db/NDPluginSchemas.template @@ -1,36 +1,6 @@ include "NDPluginBase.template" -record(stringout, "$(P)$(R)AddrAttr") { - field(VAL, "$(ADDR_ATTR=ad00_schema)") - field(DTYP, "asynOctetWrite") - field(OUT, "@asyn($(PORT),$(ADDR),$(TIMEOUT))ADDR_ATTR_NAME") - field(FLNK, "$(P)$(R)AddrAttr_RBV") - field(PINI, "YES") - - info(asyn:READBACK, "1") -} - -record(stringin, "$(P)$(R)AddrAttr_RBV") { - field(DTYP, "asynOctetRead") - field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))ADDR_ATTR_NAME") -} - -record(stringout, "$(P)$(R)SizeAttr") { - field(VAL, "$(SIZE_ATTR=ad00_schema_size)") - field(DTYP, "asynOctetWrite") - field(OUT, "@asyn($(PORT),$(ADDR),$(TIMEOUT))SIZE_ATTR_NAME") - field(FLNK, "$(P)$(R)SizeAttr_RBV") - field(PINI, "YES") - - info(asyn:READBACK, "1") -} - -record(stringin, "$(P)$(R)SizeAttr_RBV") { - field(DTYP, "asynOctetRead") - field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))SIZE_ATTR_NAME") -} - record(mbbo, "$(P)$(R)SchemaSelect") { field(PINI, "YES") diff --git a/SchemasApp/src/NDArraySerializer.cpp b/SchemasApp/src/AD00Schema.cpp similarity index 90% rename from SchemasApp/src/NDArraySerializer.cpp rename to SchemasApp/src/AD00Schema.cpp index 95134828cfbd6ed190e07dbb16fc55a832b129ac..42da89915548afce869834751dc6dbd63b9edf9b 100644 --- a/SchemasApp/src/NDArraySerializer.cpp +++ b/SchemasApp/src/AD00Schema.cpp @@ -1,11 +1,11 @@ /** Copyright (C) 2017 European Spallation Source */ -/** @file NDArraySerializer.cpp +/** @file AD00Schema.cpp * @brief Implementation of simple class which serializes EPICS NDArray into a * Flatbuffer. */ -#include "NDArraySerializer.h" +#include "AD00Schema.h" #include "TimeUtility.h" #include <cassert> #include <ciso646> @@ -13,11 +13,11 @@ #include <memory> #include <vector> -NDArraySerializer::NDArraySerializer(std::string SourceName, +AD00Schema::AD00Schema(std::string SourceName, const flatbuffers::uoffset_t bufferSize) : SourceName(SourceName), builder(bufferSize) {} -bool NDArraySerializer::setSourceName(std::string NewSourceName) { +bool AD00Schema::setSourceName(std::string NewSourceName) { if (NewSourceName.empty()) { return false; } @@ -25,9 +25,9 @@ bool NDArraySerializer::setSourceName(std::string NewSourceName) { return true; } -std::string NDArraySerializer::getSourceName() { return SourceName; } +std::string AD00Schema::getSourceName() { return SourceName; } -void NDArraySerializer::SerializeData(NDArray &pArray, +void AD00Schema::SerializeData(NDArray &pArray, unsigned char *&bufferPtr, size_t &bufferSize) { NDArrayInfo ndInfo{}; @@ -99,7 +99,7 @@ void NDArraySerializer::SerializeData(NDArray &pArray, bufferSize = builder.GetSize(); } -DType NDArraySerializer::GetFB_DType(NDDataType_t arrType) { +DType AD00Schema::GetFB_DType(NDDataType_t arrType) { switch (arrType) { case NDInt8: return DType::DType_int8; @@ -127,7 +127,7 @@ DType NDArraySerializer::GetFB_DType(NDDataType_t arrType) { return DType::DType_int8; } -NDDataType_t NDArraySerializer::GetND_DType(DType arrType) { +NDDataType_t AD00Schema::GetND_DType(DType arrType) { switch (arrType) { case DType::DType_int8: return NDInt8; @@ -155,7 +155,7 @@ NDDataType_t NDArraySerializer::GetND_DType(DType arrType) { return NDInt8; } -DType NDArraySerializer::GetFB_DType(NDAttrDataType_t attrType) { +DType AD00Schema::GetFB_DType(NDAttrDataType_t attrType) { switch (attrType) { case NDAttrInt8: return DType::DType_int8; @@ -185,7 +185,7 @@ DType NDArraySerializer::GetFB_DType(NDAttrDataType_t attrType) { return DType::DType_int8; } -NDAttrDataType_t NDArraySerializer::GetND_AttrDType(DType attrType) { +NDAttrDataType_t AD00Schema::GetND_AttrDType(DType attrType) { switch (attrType) { case DType::DType_int8: return NDAttrInt8; diff --git a/SchemasApp/src/NDArraySerializer.h b/SchemasApp/src/AD00Schema.h similarity index 95% rename from SchemasApp/src/NDArraySerializer.h rename to SchemasApp/src/AD00Schema.h index 9476507d910935e067726b5ac83f522c403a6a2f..d85c01bad8aec6574bf119d408669fcbe38e3548 100644 --- a/SchemasApp/src/NDArraySerializer.h +++ b/SchemasApp/src/AD00Schema.h @@ -1,6 +1,6 @@ /** Copyright (C) 2017 European Spallation Source */ -/** @file NDArraySerializer.h +/** @file AD00Schema.h * @brief Serialisation of NDArray data using Google Flatbuffer. */ #pragma once @@ -16,7 +16,7 @@ * copy the data or use * several instances of this class. */ -class NDArraySerializer { +class AD00Schema { public: /** @brief Initialize the flatbuffer builder with a given buffer size. * The default buffer size given here is 1MB though. If the buffer is to small @@ -29,12 +29,12 @@ public: * if the data does * not fit. */ - explicit NDArraySerializer(std::string SourceName, + explicit AD00Schema(std::string SourceName, const flatbuffers::uoffset_t bufferSize = 1048576); /** @brief Serializes data held in the input NDArray. * Note that the returned pointer is only valid until next time - * NDArraySerializer::SerializeData() is called! + * AD00Schema::SerializeData() is called! * @param[in] pArray The data to be serialized. * @param[out] bufferPtr The pointer to the serialized data. Note that this * pointer is only diff --git a/SchemasApp/src/EV44Schema.cpp b/SchemasApp/src/EV44Schema.cpp index 2f04871ac6ea08e0e981483e74495e9796bdaae9..89d8c4d88c1166f999f0c477e17faba864936f1a 100644 --- a/SchemasApp/src/EV44Schema.cpp +++ b/SchemasApp/src/EV44Schema.cpp @@ -27,138 +27,70 @@ bool EV44Schema::setSourceName(std::string NewSourceName) { std::string EV44Schema::getSourceName() { return SourceName; } -void EV44Schema::SerializeData(NDArray &pArray, +int EV44Schema::SerializeData(NDArray &pArray, unsigned char *&bufferPtr, size_t &bufferSize) { - /** - * Find relevant attributes - * @todo remove "(n)GEM coincidence event" or make the name selectable by the user - */ + builder.Clear(); - NDAttribute * pTOFAttr = pArray.pAttributeList->find("GEM coincidence event TOF"); - NDAttribute * pFXAttr = pArray.pAttributeList->find("GEM coincidence event FX"); - NDAttribute * pFYAttr = pArray.pAttributeList->find("GEM coincidence event FY"); - NDAttribute * pRefTimeAttr = pArray.pAttributeList->find("Reference time"); - NDAttribute * pRefTimeIdxAttr = pArray.pAttributeList->find("Reference time index"); - - /** - * Get the information of the attributes and store them as vectors - */ - - std::vector<uint32_t> *TOF; - std::vector<uint8_t> *FX; - std::vector<uint8_t> *FY; - std::vector<epicsTimeStamp> *refTime; - std::vector<int32_t> *refTimeIdx; - - pTOFAttr->getValue(NDAttrUInt64, &TOF); - pFXAttr->getValue(NDAttrUInt64, &FX); - pFYAttr->getValue(NDAttrUInt64, &FY); - pRefTimeAttr->getValue(NDAttrUInt64, &refTime); - pRefTimeIdxAttr->getValue(NDAttrUInt64, &refTimeIdx); + std::vector<uint32_t> TOFs; + std::vector<int32_t> flatPixels; - /** - * Print few debug/info logs - * @todo change this to asynPrint or epics related log system - */ - printf("End of frame timestamp (EPICS fmt time): %u.%u s\n", pArray.epicsTS.secPastEpoch, pArray.epicsTS.nsec); - printf("TOF: [ "); - for(size_t i=0; i<TOF->size(); i++) { - printf("%u ns ", (*TOF)[i]); + /* Computing number of elements this way is cheaper than using pArray.getInfo() */ + if ( (pArray.dataSize % sizeof(GenericEvent)) != 0) { + return 1; } - printf("]\n"); + size_t num_events = pArray.dataSize/sizeof(GenericEvent); - printf("FX: [ "); - for(size_t i=0; i<FX->size(); i++) { - printf("%u ", (*FX)[i]); - } - printf("]\n"); + /* Getting Coincidence events and T0Event from NDArray + It is expected that either all events are Coincidence events or only the first one is T0 + and all other are Coincidence.*/ + std::vector<GenericEvent> events(static_cast<GenericEvent*>(pArray.pData), + static_cast<GenericEvent*>(pArray.pData) + num_events); - printf("FY: [ "); - for(size_t i=0; i<FY->size(); i++) { - printf("%u ", (*FY)[i]); - } - printf("]\n"); - - printf("refTime (external src, POSIX fmt time): [ "); - for(size_t i=0; i<refTime->size(); i++) { - printf("%u.%u s ", ((*refTime)[i]).secPastEpoch+POSIX_TIME_AT_EPICS_EPOCH, ((*refTime)[i]).nsec); - } - printf("]\n"); + /* Creating reference time vector to store timestamps */ + std::vector<int64_t> referenceTime(1, 0); - printf("refTimeIdx (external src time, pulse counter): [ "); - for(size_t i=0; i<refTimeIdx->size(); i++) { - printf("%u ", (*refTimeIdx)[i]); - } - printf("]\n"); - printf("\n"); + for (GenericEvent & event : events) { + if (event.eventType == EventType::Coincidence){ + TOFs.push_back(event.event.cEvent.TOF); + flatPixels.push_back(event.event.cEvent.FY + NGEM_IMAGE_SIZE * event.event.cEvent.FX); - /** - * Change x and y pixel coordinates to a flatten pixel coordinate - * flat_addr = y + x*size_y - * @todo remove 128 hardcoded value - */ + referenceTime[0] = ((1e9) * (event.TS.secPastEpoch) + event.TS.nsec); - std::vector<int32_t> flatPixelCoord(FX->size()); - - for (size_t i = 0; i < FX->size(); ++i) { - flatPixelCoord[i] = (*FY)[i] + 128 * (*FX)[i]; + } } - /** @todo This might not be the best approach since it might clear while the driver is writing */ - delete FX; - delete FY; - - /** - * Convert epics timestamp to integer nanoseconds since epoch needed by the schema - * Convert also the epics epoch (1990) to posix time epoch (1970) - */ - - std::vector<int64_t> refTimeSchema(refTime->size()); - - for (size_t i = 0; i < refTime->size(); ++i) { - refTimeSchema[i] = (1e9)*(((*refTime)[i]).secPastEpoch + POSIX_TIME_AT_EPICS_EPOCH) + ((*refTime)[i]).nsec; - } + std::vector<int32_t> referenceTimeIndex(1, 0); - /** @todo This might not be the best approach since it might clear while the driver is writing */ - delete refTime; - - /** - * Some vectors need casting - */ - - std::vector<int32_t> castedTOF(TOF->begin(), TOF->end()); - - /** @todo This might not be the best approach since it might clear while the driver is writing */ - delete TOF; + /* Cast TOF to int32 because EV44 uses it that way... */ + std::vector<int32_t> castedTOFs(TOFs.begin(), TOFs.end()); /** * Convert the vectors from the driver into ev44 flatbuffer vectors and forward the message */ flatbuffers::Offset<flatbuffers::String> SourceNamePtr = builder.CreateString(SourceName); - flatbuffers::Offset<flatbuffers::Vector<int64_t>> reference_time = builder.CreateVector(refTimeSchema); - flatbuffers::Offset<flatbuffers::Vector<int32_t>> reference_time_index = builder.CreateVector(*refTimeIdx); - flatbuffers::Offset<flatbuffers::Vector<int32_t>> time_of_flight = builder.CreateVector(castedTOF); - flatbuffers::Offset<flatbuffers::Vector<int32_t>> pixel_id = builder.CreateVector(flatPixelCoord); - - /** @todo This might not be the best approach since it might clear while the driver is writing */ - delete refTimeIdx; - - flatbuffers::Offset<Event44Message> kf_pkg = CreateEvent44Message(builder, - SourceNamePtr, - pArray.uniqueId, - reference_time, - reference_time_index, - time_of_flight, - pixel_id); - + flatbuffers::Offset<flatbuffers::Vector<int32_t>> time_of_flight = builder.CreateVector(castedTOFs); + flatbuffers::Offset<flatbuffers::Vector<int64_t>> reference_time = builder.CreateVector(referenceTime); + flatbuffers::Offset<flatbuffers::Vector<int32_t>> reference_time_index = builder.CreateVector(referenceTimeIndex); + flatbuffers::Offset<flatbuffers::Vector<int32_t>> pixel_id = builder.CreateVector(flatPixels); + + flatbuffers::Offset<Event44Message> kf_pkg = CreateEvent44Message(builder, + SourceNamePtr, + pArray.uniqueId, + reference_time, + reference_time_index, + time_of_flight, + pixel_id); + builder.Finish(kf_pkg, Event44MessageIdentifier()); bufferPtr = builder.GetBufferPointer(); bufferSize = builder.GetSize(); + return 0; + } diff --git a/SchemasApp/src/EV44Schema.h b/SchemasApp/src/EV44Schema.h index 516ab8d67f439c90e51d62202740203d92261bbf..1152be36d3028510dcccb16478f061f7ec60dbd8 100644 --- a/SchemasApp/src/EV44Schema.h +++ b/SchemasApp/src/EV44Schema.h @@ -9,6 +9,8 @@ #include <NDArray.h> #include <flatbuffers/flatbuffers.h> +#include "ngemProperties.h" + /** @brief Class which is used to serialize NDArray data using flatbuffers. * The C++ flatbuffers implementation has an internal buffer for storing the * serialized data. Thus @@ -41,7 +43,7 @@ public: * valid until the member function is called again. * @param[out] bufferSize Size of serialized data in bytes. */ - void SerializeData(NDArray &pArray, unsigned char *&bufferPtr, + int SerializeData(NDArray &pArray, unsigned char *&bufferPtr, size_t &bufferSize); bool setSourceName(std::string NewSourceName); diff --git a/SchemasApp/src/NDPluginSchemas.cpp b/SchemasApp/src/NDPluginSchemas.cpp index b18ce7f12cf8f7e96408bc9c8c655b51ef9dd731..38f3d34c801d84abf1e891c1134070845cb25c0f 100644 --- a/SchemasApp/src/NDPluginSchemas.cpp +++ b/SchemasApp/src/NDPluginSchemas.cpp @@ -31,26 +31,10 @@ NDPluginSchemas::NDPluginSchemas(const char *portName, int queueSize, int blocki priority, stackSize, 1), // maxThreads - Serializer(sourceName), + AD00(sourceName), EV44(sourceName) { - removeOldAddrAttrEvendId = epicsEventCreate(epicsEventEmpty); - if (!removeOldAddrAttrEvendId) { - printf("%s:%s [Error] Failed to create 'remove old address' event\n", - this->portName, __PRETTY_FUNCTION__); - return; - } - - removeOldSizeAttrEvendId = epicsEventCreate(epicsEventEmpty); - if (!removeOldAddrAttrEvendId) { - printf("%s:%s [Error] Failed to create 'remove old size' event\n", - this->portName, __PRETTY_FUNCTION__); - return; - } - - createParam(SchemasaddrAttrString, asynParamOctet, &addrAttrParam); - createParam(SchemassizeAttrString, asynParamOctet, &sizeAttrParam); createParam(SchemaSelectString, asynParamInt32, &schemaSelectParam); } @@ -64,48 +48,24 @@ NDPluginSchemas::processCallbacks(NDArray *pArray) unsigned char * bufferPtr; size_t bufferSize; int status = 0; - int schemaSelect; - static char dataAttrName[MAX_STRINGOUT_RECORD_LENGTH]; - static char sizeAttrName[MAX_STRINGOUT_RECORD_LENGTH]; - status = (int)getStringParam(addrAttrParam, MAX_STRINGOUT_RECORD_LENGTH, dataAttrName); getIntegerParam(schemaSelectParam, &schemaSelect); - if(status) { - asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR, - "%s:%s: [Error] Failed to read the attribute name of data address.\n", - this->portName, __PRETTY_FUNCTION__); - return; - } - else { - asynPrint(this->pasynUserSelf, ASYN_TRACE_FLOW, - "%s:%s: Read the attribute name of data address: '%s'.\n", - this->portName, __PRETTY_FUNCTION__, dataAttrName); - } - - status = (int)getStringParam(sizeAttrParam, MAX_STRINGOUT_RECORD_LENGTH, sizeAttrName); - - if(status) { - asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR, - "%s:%s: [Error] Failed to read the attribute name of data size.\n", - this->portName, __PRETTY_FUNCTION__); - return; - } - else { - asynPrint(this->pasynUserSelf, ASYN_TRACE_FLOW, - "%s:%s: Read the attribute name of data size: '%s'.\n", - this->portName, __PRETTY_FUNCTION__, sizeAttrName); - } - NDPluginDriver::beginProcessCallbacks(pArray); switch (schemaSelect) { case 0: - Serializer.SerializeData(*pArray, bufferPtr, bufferSize); + AD00.SerializeData(*pArray, bufferPtr, bufferSize); break; case 1: - EV44.SerializeData(*pArray, bufferPtr, bufferSize); + status = EV44.SerializeData(*pArray, bufferPtr, bufferSize); + if (status) { + asynPrint(this->pasynUserSelf, ASYN_TRACE_FLOW, + "%s:%s: Array data size not multiple of sizeof(CoincidenceEvent)!\n", + this->portName, __PRETTY_FUNCTION__); + return; + } break; default: break; @@ -119,143 +79,15 @@ NDPluginSchemas::processCallbacks(NDArray *pArray) "%s:%s: Serialized data address: 0x%lx.\n", this->portName, __PRETTY_FUNCTION__, (uint64_t)bufferPtr); - pOutput = this->pNDArrayPool->copy(pArray, NULL, 1); - - asynPrint(this->pasynUserSelf, ASYN_TRACE_FLOW, - "%s:%s: pArray: 0x%lx pOutput: 0x%lx.\n", - this->portName, __PRETTY_FUNCTION__, (uint64_t)pArray, (uint64_t)pOutput); - - status = (int)epicsEventTryWait(removeOldAddrAttrEvendId); - - if(status == (int)epicsEventWaitOK) { - status = pOutput->pAttributeList->remove(oldAddrAttrName); - if(status == ND_SUCCESS) { - asynPrint(this->pasynUserSelf, ASYN_TRACE_FLOW, - "%s:%s: Removing old address attribute '%s'.\n", - this->portName, __PRETTY_FUNCTION__, oldAddrAttrName); - } - else if(status == ND_ERROR) { - asynPrint(this->pasynUserSelf, ASYN_TRACE_FLOW, - "%s:%s: Failed to remove size attribute '%s'.\n", - this->portName, __PRETTY_FUNCTION__, oldAddrAttrName); - } - } - - status = (int)epicsEventTryWait(removeOldSizeAttrEvendId); - - if(status == (int)epicsEventWaitOK) { - status = pOutput->pAttributeList->remove(oldSizeAttrName); - if(status == ND_SUCCESS) { - asynPrint(this->pasynUserSelf, ASYN_TRACE_FLOW, - "%s:%s: Removing old address attribute '%s'.\n", - this->portName, __PRETTY_FUNCTION__, oldSizeAttrName); - } - else if(status == ND_ERROR) { - asynPrint(this->pasynUserSelf, ASYN_TRACE_FLOW, - "%s:%s: Failed to remove size attribute '%s'.\n", - this->portName, __PRETTY_FUNCTION__, oldSizeAttrName); - } - } - - pOutput->pAttributeList->add(dataAttrName, - "Area Detector data formated into ECDC ad00 schema", - NDAttrUInt64, - &bufferPtr); - - pOutput->pAttributeList->add(sizeAttrName, - "Area Detector size in bytes of data formated into ECDC ad00 schema", - NDAttrUInt64, - &bufferSize); - - asynPrint(pasynUserSelf, ASYN_TRACE_FLOW, - "%s:%s: Finished processing.\n", this->portName, __PRETTY_FUNCTION__); + this->ndims[0] = bufferSize; + pOutput = this->pNDArrayPool->alloc(1, this->ndims, NDUInt8, bufferSize, NULL); + memcpy(pOutput->pData, bufferPtr, bufferSize); + pOutput->epicsTS = pArray->epicsTS; NDPluginDriver::endProcessCallbacks(pOutput, false, false); } -asynStatus NDPluginSchemas::readOctet(asynUser *pasynUser, char *value, - size_t maxChars, size_t *nActual, - int *eomReason) { - int status = 0; - int function = pasynUser->reason; - - status |= (int)getStringParam(function, maxChars, value); - - *nActual = strlen(value); - - if(function < FIRST_NDPLUGINSCHEMAS_PARAM) - return NDPluginDriver::readOctet(pasynUser, value, - maxChars, nActual, - eomReason); - else if(function == addrAttrParam) { - asynPrint(this->pasynUserSelf, ASYN_TRACE_FLOW, - "%s:%s: Reading addrAttrParam. Read value: '%s'\n", - this->portName, __PRETTY_FUNCTION__, value); - } - else if(function == sizeAttrParam) { - asynPrint(this->pasynUserSelf, ASYN_TRACE_FLOW, - "%s:%s: Reading sizeAttrParam. Read value: '%s'\n", - this->portName, __PRETTY_FUNCTION__, value); - } - - return (asynStatus)status; - -} - -asynStatus NDPluginSchemas::writeOctet(asynUser *pasynUser, const char *value, - size_t nChars, size_t *nActual) { - int status = 0; - int function = pasynUser->reason; - char tempAttrName[MAX_STRINGOUT_RECORD_LENGTH]; - - status |= (int)getStringParam(function, MAX_STRINGOUT_RECORD_LENGTH, tempAttrName); - - if(function < FIRST_NDPLUGINSCHEMAS_PARAM) { - return NDPluginDriver::writeOctet(pasynUser, value, - nChars, nActual); - } - else if(!strcmp(tempAttrName, value)) { - - *nActual = 0; - - asynPrint(this->pasynUserSelf, ASYN_TRACE_FLOW, - "%s:%s: Parameter value did not change. Nothing was done.\n", - this->portName, __PRETTY_FUNCTION__); - - } - else { - if(function == addrAttrParam) { - - strcpy(oldAddrAttrName, tempAttrName); - - epicsEventSignal(removeOldAddrAttrEvendId); - - asynPrint(this->pasynUserSelf, ASYN_TRACE_FLOW, - "%s:%s: Modifying addrAttrParam. New value: '%s'\n", - this->portName, __PRETTY_FUNCTION__, value); - - } - else if(function == sizeAttrParam) { - - strcpy(oldSizeAttrName, tempAttrName); - - epicsEventSignal(removeOldSizeAttrEvendId); - - asynPrint(this->pasynUserSelf, ASYN_TRACE_FLOW, - "%s:%s: Modifying sizeAttrParam. New value: '%s'\n", - this->portName, __PRETTY_FUNCTION__, value); - - } - - status |= (int)setStringParam(function, value); - *nActual = nChars; - callParamCallbacks(); - } - - return (asynStatus)status; -} - extern "C" int NDSchemasConfigure(const char *portName, int queueSize, int blockingCallbacks, const char *NDArrayPort, int NDArrayAddr, int maxBuffers, size_t maxMemory, const char *sourceName) diff --git a/SchemasApp/src/NDPluginSchemas.h b/SchemasApp/src/NDPluginSchemas.h index 127e6d03957db3ddbc2ff7977e12e167f64aa4fc..3bb49ca0a85fad93502506c46f3eecea0c0b3264 100644 --- a/SchemasApp/src/NDPluginSchemas.h +++ b/SchemasApp/src/NDPluginSchemas.h @@ -11,7 +11,7 @@ #include <epicsTypes.h> #include <shareLib.h> -#include <NDArraySerializer.h> +#include <AD00Schema.h> #include "NDPluginDriver.h" #include "EV44Schema.h" @@ -27,33 +27,19 @@ public: const char *sourceName); virtual void processCallbacks(NDArray *pArray); - virtual asynStatus readOctet(asynUser *pasynUser, char *value, - size_t maxChars, size_t *nActual, - int *eomReason); - virtual asynStatus writeOctet(asynUser *pasynUser, const char *value, - size_t nChars, size_t *nActual); protected: - #define FIRST_NDPLUGINSCHEMAS_PARAM addrAttrParam - int addrAttrParam; - int sizeAttrParam; + #define FIRST_NDPLUGINSCHEMAS_PARAM schemaSelectParam int schemaSelectParam; private: /// @brief The class instance used to serialize NDArray data. - NDArraySerializer Serializer; + AD00Schema AD00; EV44Schema EV44; - - char oldAddrAttrName[MAX_STRINGOUT_RECORD_LENGTH]; - char oldSizeAttrName[MAX_STRINGOUT_RECORD_LENGTH]; - - epicsEventId removeOldAddrAttrEvendId; - epicsEventId removeOldSizeAttrEvendId; + size_t ndims[1] = {0}; }; // Parameters. -#define SchemasaddrAttrString "ADDR_ATTR_NAME" -#define SchemassizeAttrString "SIZE_ATTR_NAME" #define SchemaSelectString "SCHEMA_SELECT"