1.air部署,细节待修改

This commit is contained in:
2022-04-15 13:51:42 +08:00
parent 3b74dfc608
commit 8c6be81f94
440 changed files with 7 additions and 883 deletions

View File

@ -0,0 +1,59 @@
/***************************************************//**
* @file Exchange.h
* @date February 2009
* @author Ocean Optics, Inc.
*
* This is simply an interface that other classes will
* extend to have a common transfer() and getHints methods
*
* 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_EXCHANGE_H
#define SEABREEZE_EXCHANGE_H
#include <vector>
#include "common/buses/TransferHelper.h"
#include "common/protocols/ProtocolHint.h"
#include "common/Data.h"
#include "common/exceptions/ProtocolException.h"
namespace seabreeze {
class Exchange {
public:
Exchange();
Exchange(std::vector<ProtocolHint *> *hints);
virtual ~Exchange();
virtual Data *transfer(TransferHelper *helper) throw (ProtocolException) = 0;
virtual const std::vector<ProtocolHint *> &getHints();
protected:
std::vector<ProtocolHint *> *hints;
};
}
#endif /* SEABREEZE_EXCHANGE_H */

View File

@ -0,0 +1,62 @@
/***************************************************//**
* @file Protocol.h
* @date February 2009
* @author Ocean Optics, Inc.
*
* This is a simple identifier cookie that will allow two
* objects to agree on whether they support a given command
* set (protocol). Each will hold Protocol objects that they
* can then compare to see if they agree. This allows a loose
* binding between sets of Exchanges (elsewhere called protocols)
* and buses.
*
* 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_PROTOCOL_H
#define SEABREEZE_PROTOCOL_H
#include "common/protocols/ProtocolFamily.h"
namespace seabreeze {
class Protocol {
public:
Protocol(int id);
/* Copy constructor */
Protocol(Protocol const &that);
virtual ~Protocol();
bool equals(Protocol const &that);
virtual ProtocolFamily getProtocolFamily() = 0;
protected:
/* Protected for derived classes to use. */
Protocol();
int id;
};
}
#endif

View File

@ -0,0 +1,55 @@
/***************************************************//**
* @file ProtocolFamily.h
* @date February 2012
* @author Ocean Optics, Inc.
*
* This provides a way to describe different kinds
* protocols (e.g. OOI, OBP) generically.
*
* 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_PROTOCOLFAMILY_H
#define SEABREEZE_PROTOCOLFAMILY_H
#include <string>
namespace seabreeze {
class ProtocolFamily {
public:
virtual ~ProtocolFamily();
virtual std::string getName();
virtual bool equals(const ProtocolFamily &that);
virtual unsigned short getType();
protected:
ProtocolFamily(std::string name, unsigned short id);
private:
std::string protocolName;
unsigned short type;
};
}
#endif

View File

@ -0,0 +1,60 @@
/***************************************************//**
* @file ProtocolHelper.h
* @date July 2009
* @author Ocean Optics, Inc.
*
* Feature instances may look up an implementation object
* that matches a particular Protocol. All such implementations
* should in some way derive from ProtocolHelper so that
* Feature's look up mechanism can return them. It is
* expected that each Feature will have a corresponding
* interface at the Protocol layer; those interface classes
* should derive from this class, and their implementations
* will thus extend this as well.
*
* 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_PROTOCOLHELPER_H
#define SEABREEZE_PROTOCOLHELPER_H
#include "common/protocols/Protocol.h"
namespace seabreeze {
class ProtocolHelper {
public:
ProtocolHelper(Protocol *proto);
virtual ~ProtocolHelper();
Protocol &getProtocol();
protected:
/* Protected for derived classes to use. */
ProtocolHelper();
Protocol *protocol;
};
}
#endif

View File

@ -0,0 +1,73 @@
/***************************************************//**
* @file ProtocolHint.h
* @date February 2009
* @author Ocean Optics, Inc.
*
* Hints are used to identify particular characteristics about
* protocol Transfer objects. A hint may be used to indicate
* to a bus some detail it needs about making a transfer, e.g.
* what endpoint would be appropriate for USB. Note that the
* bus (or its helpers) are under no obligation to respect hints.
*
* 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_PROTOCOLHINT_H
#define SEABREEZE_PROTOCOLHINT_H
#include "common/SeaBreeze.h"
#include <string>
namespace seabreeze {
class ProtocolHint {
public:
ProtocolHint(int id, std::string desc);
/* For derived classes that will fill in their own values
* and for containers to be able to initialize themselves.
* This does not set any meaningful values and should not be
* relied on to create a proper instance.
*/
ProtocolHint();
virtual ~ProtocolHint();
std::string getDescription();
int getID() const;
/* Overloading the equality operator so that this can be
* used as a key for hash_map associations without the actual
* key objects having to be identical.
*/
bool operator==(const ProtocolHint &that);
protected:
int id;
std::string description;
};
}
#endif /* SEABREEZE_PROTOCOLHINT_H */

View File

@ -0,0 +1,82 @@
/***************************************************//**
* @file Transaction.h
* @date February 2009
* @author Ocean Optics, Inc.
*
* The Transaction class is simply a wrapper
* around one or more Transfer objects that must
* be executed in a particular order. This is
* provided for convenience. Some transfers
* to Ocean Optics spectrometers put the spectrometer
* into a particular state where it expects another
* action to be taken, and Transaction objects can
* be used to ensure that all expected operations occur.
*
* Some actions, like requesting a spectrum, do not
* necessarily require that the next action be a read
* operation. Thus, some Transfers that appear to follow
* a causal chain may not in fact make good Transactions.
* In this case, reading the status of the device until
* it reports data ready is a common operation before
* reading the spectrum.
*
* Note that the Transaction class has no notion of buses
* or protocols, and this is by design.
*
* 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_TRANSACTION_H
#define SEABREEZE_TRANSACTION_H
#include <vector>
#include "common/protocols/Exchange.h"
#include "common/protocols/Transfer.h"
#include "common/buses/TransferHelper.h"
#include "common/protocols/ProtocolHint.h"
#include "common/Data.h"
namespace seabreeze {
class Transaction : public Exchange {
public:
Transaction();
virtual ~Transaction();
void addTransfer(Transfer *xfer);
/* Inherited from Exchange */
virtual Data *transfer(TransferHelper *helper) throw (ProtocolException);
protected:
std::vector<Transfer *> transfers;
private:
void updateHints();
};
}
#endif /* SEABREEZE_TRANSACTION_H */

View File

@ -0,0 +1,93 @@
/***************************************************//**
* @file Transfer.h
* @date February 2009
* @author Ocean Optics, Inc.
*
* The Transfer class captures a simplex
* data transfer to or from a device. At this
* level, there is no notion of a particular bus,
* just data, length, and direction.
*
* The bus aspects are encapsulated in a "helper"
* object that must be provided when the Transfer
* is executed. The helper must provide send() and
* receive() methods taking a buffer and length
* only. All of the details in getting the transfer to
* or from the other end must be handled by the helper.
* The helper is expected to be created by some aspect
* of the driver for the device in question. It contains
* information about the connection and the particulars
* about routing data in and out.
*
* Note that the Transfer class is completely orthagonal to any
* particular protocol. It is expected that a protocol may be
* built up as a collection of related Transfer types.
*
* 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_TRANSFER_H
#define SEABREEZE_TRANSFER_H
#include <vector>
#include "common/protocols/Exchange.h"
#include "common/protocols/ProtocolHint.h"
#include "common/Data.h"
typedef unsigned int direction_t;
namespace seabreeze {
class Transfer : public Exchange {
public:
/* Note that the size of the provided buffer and the specified length
* of the transfer itself do not need to agree. If the transfer requires
* more space than the buffer provides, the buffer will be resized.
* If the buffer is created larger than is needed, only the given length
* will be sent or received. This allows for some freedom in buffer
* management.
*/
Transfer(std::vector<ProtocolHint *> *hints, std::vector<byte> *buffer,
direction_t direction, unsigned int length);
virtual ~Transfer();
virtual Data *transfer(TransferHelper *helper) throw (ProtocolException);
static const direction_t TO_DEVICE;
static const direction_t FROM_DEVICE;
protected:
Transfer();
void checkBufferSize();
unsigned int length;
std::vector<byte> *buffer;
direction_t direction;
};
}
#endif /* SEABREEZE_TRANSFER_H */