主采集逻辑修改中,添加了部分写文件实现

This commit is contained in:
2021-12-02 18:07:29 +08:00
parent 95da780693
commit efbcde38d7
403 changed files with 26857 additions and 77 deletions

View File

@ -0,0 +1,52 @@
/***************************************************//**
* @file FPGARegisterProtocol.h
* @date October 2012
* @author Ocean Optics, Inc.
*
* LICENSE:
*
* SeaBreeze Copyright (C) 2014, Ocean Optics Inc
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject
* to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*******************************************************/
#ifndef SEABREEZE_FPGA_REGISTER_PROTOCOL_H
#define SEABREEZE_FPGA_REGISTER_PROTOCOL_H
#include "common/SeaBreeze.h"
#include "common/buses/Bus.h"
#include "common/exceptions/ProtocolException.h"
#include "vendors/OceanOptics/protocols/interfaces/FPGARegisterProtocolInterface.h"
namespace seabreeze {
namespace ooiProtocol {
class FPGARegisterProtocol : public FPGARegisterProtocolInterface {
public:
FPGARegisterProtocol();
virtual ~FPGARegisterProtocol();
virtual unsigned int readRegister(const Bus &bus, byte address)
throw (ProtocolException);
virtual void writeRegister(const Bus &bus, byte address,
unsigned int value) throw (ProtocolException);
};
}
}
#endif

View File

@ -0,0 +1,53 @@
/***************************************************//**
* @file OOIEEPROMProtocol.h
* @date February 2009
* @author Ocean Optics, Inc.
*
* LICENSE:
*
* SeaBreeze Copyright (C) 2014, Ocean Optics Inc
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject
* to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*******************************************************/
#ifndef OOIEEPROMPROTOCOL_H
#define OOIEEPROMPROTOCOL_H
#include "common/SeaBreeze.h"
#include "common/buses/Bus.h"
#include "common/exceptions/ProtocolException.h"
#include "vendors/OceanOptics/protocols/interfaces/EEPROMProtocolInterface.h"
#include <vector>
namespace seabreeze {
namespace ooiProtocol {
class OOIEEPROMProtocol : public EEPROMProtocolInterface {
public:
OOIEEPROMProtocol();
virtual ~OOIEEPROMProtocol();
virtual std::vector<byte> *readEEPROMSlot(const Bus &bus, int slot)
throw (ProtocolException);
virtual int writeEEPROMSlot(const Bus &bus, int slot,
const std::vector<byte> &data) throw (ProtocolException);
};
}
}
#endif /* OOIEEPROMPROTOCOL_H */

View File

@ -0,0 +1,63 @@
/***************************************************//**
* @file OOIIrradCalProtocol.h
* @date March 2010
* @author Ocean Optics, Inc.
*
* LICENSE:
*
* SeaBreeze Copyright (C) 2014, Ocean Optics Inc
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject
* to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*******************************************************/
#ifndef OOIIRRADCALPROTOCOL_H
#define OOIIRRADCALPROTOCOL_H
#include "common/buses/Bus.h"
#include "vendors/OceanOptics/protocols/interfaces/IrradCalProtocolInterface.h"
#include "vendors/OceanOptics/protocols/ooi/exchanges/OOIReadIrradCalExchange.h"
#include "vendors/OceanOptics/protocols/ooi/exchanges/OOIWriteIrradCalExchange.h"
#include "common/exceptions/ProtocolException.h"
namespace seabreeze {
namespace ooiProtocol {
class OOIIrradCalProtocol : public IrradCalProtocolInterface {
public:
OOIIrradCalProtocol(unsigned int numberOfPixels);
virtual ~OOIIrradCalProtocol();
/* Inherited from IrradCalProtocolInterface */
virtual std::vector<float> *readIrradCal(const Bus &bus)
throw (ProtocolException);
virtual int writeIrradCal(const Bus &bus, const std::vector<float> &cal)
throw (ProtocolException);
virtual int hasCollectionArea(const Bus &bus);
virtual float readCollectionArea(const Bus &bus)
throw (ProtocolException);
virtual void writeCollectionArea(const Bus &bus, float area)
throw (ProtocolException);
private:
unsigned int numberOfPixels;
};
}
}
#endif /* OOIIRRADCALPROTOCOL_H */

View File

@ -0,0 +1,51 @@
/***************************************************//**
* @file OOIProtocol.h
* @date February 2009
* @author Ocean Optics, Inc.
*
* This provides a singleton object that identifies the
* OOI legacy USB command set.
*
* LICENSE:
*
* SeaBreeze Copyright (C) 2014, Ocean Optics Inc
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject
* to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*******************************************************/
#ifndef OOIPROTOCOL_H
#define OOIPROTOCOL_H
#include "common/protocols/Protocol.h"
namespace seabreeze {
namespace ooiProtocol {
class OOIProtocol : public Protocol {
public:
OOIProtocol();
virtual ~OOIProtocol();
/* Must be overridden from Protocol */
virtual ProtocolFamily getProtocolFamily();
};
}
}
#endif /* OOIPROTOCOL_H */

View File

@ -0,0 +1,79 @@
/***************************************************//**
* @file OOISpectrometerProtocol.h
* @date February 2009
* @author Ocean Optics, Inc.
*
* LICENSE:
*
* SeaBreeze Copyright (C) 2014, Ocean Optics Inc
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject
* to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*******************************************************/
#ifndef OOISPECTROMETERPROTOCOL_H
#define OOISPECTROMETERPROTOCOL_H
#include "common/SeaBreeze.h"
#include "common/protocols/Exchange.h"
#include "common/buses/Bus.h"
#include "vendors/OceanOptics/protocols/ooi/exchanges/IntegrationTimeExchange.h"
#include "vendors/OceanOptics/protocols/ooi/exchanges/TriggerModeExchange.h"
#include "vendors/OceanOptics/protocols/interfaces/SpectrometerProtocolInterface.h"
#include <vector>
namespace seabreeze {
namespace ooiProtocol {
class OOISpectrometerProtocol : public SpectrometerProtocolInterface {
public:
OOISpectrometerProtocol(
IntegrationTimeExchange *integrationTimeExchange,
Transfer *requestSpectrumExchange,
Transfer *unformattedSpectrumExchange,
Transfer *spectrumTransferExchange,
TriggerModeExchange *triggerMode);
virtual ~OOISpectrometerProtocol();
/* FIXME: instead of returning primitive vectors, should this return Data* so that
* metadata (units, etc.) can also be attached?
*/
virtual std::vector<byte> *readUnformattedSpectrum(const Bus &bus)
throw (ProtocolException);
virtual std::vector<double> *readSpectrum(const Bus &bus)
throw (ProtocolException);
virtual void requestSpectrum(const Bus &bus) throw (ProtocolException);
virtual void setIntegrationTimeMicros(const Bus &bus,
unsigned long time_usec) throw (ProtocolException);
virtual void setTriggerMode(const Bus &bus,
SpectrometerTriggerMode &mode) throw (ProtocolException);
private:
IntegrationTimeExchange *integrationTimeExchange;
/* These are Transfers instead of Exchanges so that we can call getHints() on them.
* if getHints is promoted up to the level of Exchange, then these can revert back.
*/
Transfer *unformattedSpectrumExchange;
Transfer *requestSpectrumExchange;
Transfer *spectrumTransferExchange;
TriggerModeExchange *triggerModeExchange;
};
}
}
#endif /* OOISPECTROMETERPROTOCOL_H */

View File

@ -0,0 +1,55 @@
/***************************************************//**
* @file OOIStrobeLampProtocol.h
* @date February 2009
* @author Ocean Optics, Inc.
*
* LICENSE:
*
* SeaBreeze Copyright (C) 2014, Ocean Optics Inc
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject
* to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*******************************************************/
#ifndef OOISTROBELAMPPROTOCOL_H
#define OOISTROBELAMPPROTOCOL_H
#include "common/buses/Bus.h"
#include "vendors/OceanOptics/protocols/ooi/exchanges/StrobeEnableExchange.h"
#include "vendors/OceanOptics/protocols/interfaces/StrobeLampProtocolInterface.h"
#include "common/exceptions/ProtocolException.h"
namespace seabreeze {
namespace ooiProtocol {
class OOIStrobeLampProtocol : public StrobeLampProtocolInterface {
public:
OOIStrobeLampProtocol();
virtual ~OOIStrobeLampProtocol();
virtual void setStrobeLampEnable(const Bus &bus, bool enable)
throw (ProtocolException);
private:
StrobeEnableExchange *strobeEnableExchange;
};
}
}
#endif /* OOISTROBELAMPPROTOCOL_H */

View File

@ -0,0 +1,65 @@
/***************************************************//**
* @file OOITECProtocol.h
* @date February 2009
* @author Ocean Optics, Inc.
*
* LICENSE:
*
* SeaBreeze Copyright (C) 2014, Ocean Optics Inc
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject
* to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*******************************************************/
#ifndef OOITECPROTOCOL_H
#define OOITECPROTOCOL_H
#include "common/buses/Bus.h"
#include "vendors/OceanOptics/protocols/interfaces/ThermoElectricProtocolInterface.h"
#include "vendors/OceanOptics/protocols/ooi/exchanges/TECEnableExchange.h"
#include "vendors/OceanOptics/protocols/ooi/exchanges/WriteTECSetPointExchange.h"
#include "vendors/OceanOptics/protocols/ooi/exchanges/ReadTECTemperatureExchange.h"
#include "common/exceptions/ProtocolException.h"
namespace seabreeze {
namespace ooiProtocol {
class OOITECProtocol : public ThermoElectricProtocolInterface {
public:
OOITECProtocol(TECEnableExchange *enableExchange,
WriteTECSetPointExchange *writeSetPointExchange,
ReadTECTemperatureExchange *readTECTempExchange);
virtual ~OOITECProtocol();
/* Inherited from ThermoElectricProtocolInterface */
virtual double readThermoElectricTemperatureCelsius(const Bus &bus)
throw (ProtocolException);
virtual void writeThermoElectricEnable(const Bus &bus, bool enable)
throw (ProtocolException);
virtual void writeThermoElectricSetPointCelsius(const Bus &bus, double degreesC)
throw (ProtocolException);
private:
TECEnableExchange *tecEnable;
WriteTECSetPointExchange *tecWriteSetPoint;
ReadTECTemperatureExchange *tecReadTemperature;
};
}
}
#endif /* OOITECPROTOCOL_H */