mirror of
http://172.16.0.230/r/SIF/TowerOptoSifAndSpectral.git
synced 2025-10-19 03:49:42 +08:00
添加了位置定标程序 及位置移动相关程序源码
This commit is contained in:
66
othersoft/shuttercali/source/OSIF/include/common/buses/Bus.h
Normal file
66
othersoft/shuttercali/source/OSIF/include/common/buses/Bus.h
Normal file
@ -0,0 +1,66 @@
|
||||
/***************************************************//**
|
||||
* @file Bus.h
|
||||
* @date February 2009
|
||||
* @author Ocean Optics, Inc.
|
||||
*
|
||||
* This provides a base class for all sorts of buses. A bus
|
||||
* is a mechanism for transferring a stream of data from one
|
||||
* point to another. The bus does not concern itself with the
|
||||
* contents of the data stream. At most, it may use hints to
|
||||
* determine how a particular message will be moved if this
|
||||
* is necessary to complete the operation.
|
||||
*
|
||||
* 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_BUS_H
|
||||
#define SEABREEZE_BUS_H
|
||||
|
||||
#include "common/protocols/ProtocolHint.h"
|
||||
#include "common/buses/TransferHelper.h"
|
||||
#include "common/buses/BusFamily.h"
|
||||
#include "common/buses/DeviceLocatorInterface.h"
|
||||
#include "common/exceptions/IllegalArgumentException.h"
|
||||
|
||||
namespace seabreeze {
|
||||
|
||||
class Bus {
|
||||
public:
|
||||
Bus();
|
||||
virtual ~Bus();
|
||||
virtual TransferHelper *getHelper(const std::vector<ProtocolHint *> &hints) const = 0;
|
||||
virtual BusFamily getBusFamily() const = 0;
|
||||
/* Associate this Bus instance with a particular device location.
|
||||
* This MUST be done before open or close can be used.
|
||||
*/
|
||||
virtual void setLocation(const DeviceLocatorInterface &location)
|
||||
throw (IllegalArgumentException) = 0;
|
||||
virtual bool open() = 0;
|
||||
virtual void close() = 0;
|
||||
virtual DeviceLocatorInterface *getLocation() = 0;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,86 @@
|
||||
/***************************************************//**
|
||||
* @file BusFamilies.h
|
||||
* @date February 2012
|
||||
* @author Ocean Optics, Inc.
|
||||
*
|
||||
* This provides a way to get references to different kinds of buses
|
||||
* (e.g. USB, Ethernet, serial) 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 BUSFAMILIES_H
|
||||
#define BUSFAMILIES_H
|
||||
|
||||
#include "common/buses/BusFamily.h"
|
||||
#include <vector>
|
||||
|
||||
namespace seabreeze {
|
||||
|
||||
class USBBusFamily : public BusFamily {
|
||||
public:
|
||||
USBBusFamily();
|
||||
virtual ~USBBusFamily();
|
||||
};
|
||||
|
||||
class EthernetBusFamily : public BusFamily {
|
||||
public:
|
||||
EthernetBusFamily();
|
||||
virtual ~EthernetBusFamily();
|
||||
};
|
||||
|
||||
class RS232BusFamily : public BusFamily {
|
||||
public:
|
||||
RS232BusFamily();
|
||||
virtual ~RS232BusFamily();
|
||||
};
|
||||
|
||||
class TCPIPv4BusFamily : public BusFamily {
|
||||
public:
|
||||
TCPIPv4BusFamily();
|
||||
virtual ~TCPIPv4BusFamily();
|
||||
};
|
||||
|
||||
class UDPIPv4BusFamily : public BusFamily {
|
||||
public:
|
||||
UDPIPv4BusFamily();
|
||||
virtual ~UDPIPv4BusFamily();
|
||||
};
|
||||
|
||||
class BusFamilies {
|
||||
public:
|
||||
const USBBusFamily USB;
|
||||
const EthernetBusFamily ETHERNET;
|
||||
const RS232BusFamily RS232;
|
||||
const TCPIPv4BusFamily TCPIPv4;
|
||||
const UDPIPv4BusFamily UDPIPv4;
|
||||
|
||||
BusFamilies();
|
||||
~BusFamilies();
|
||||
std::vector<BusFamily *> getAllBusFamilies();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* BUSFAMILIES_H */
|
@ -0,0 +1,54 @@
|
||||
/***************************************************//**
|
||||
* @file BusFamily.h
|
||||
* @date February 2012
|
||||
* @author Ocean Optics, Inc.
|
||||
*
|
||||
* This provides a way to describe different kinds of buses
|
||||
* (e.g. USB, Ethernet, serial) 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 BUSFAMILY_H
|
||||
#define BUSFAMILY_H
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace seabreeze {
|
||||
class BusFamily {
|
||||
public:
|
||||
virtual ~BusFamily();
|
||||
virtual std::string getName() const;
|
||||
virtual bool equals(const BusFamily &that);
|
||||
|
||||
protected:
|
||||
BusFamily(std::string name, int id);
|
||||
|
||||
private:
|
||||
std::string busName;
|
||||
int type;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* BUSFAMILY_H */
|
@ -0,0 +1,58 @@
|
||||
/***************************************************//**
|
||||
* @file DeviceLocationProberInterface.h
|
||||
* @date February 2012
|
||||
* @author Ocean Optics, Inc.
|
||||
*
|
||||
* DeviceLocatorInterface provides a base interface for
|
||||
* classes that allow the location of a device to be
|
||||
* probed in a bus-specific way.
|
||||
*
|
||||
* 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 DEVICELOCATIONPROBERINTERFACE_H
|
||||
#define DEVICELOCATIONPROBERINTERFACE_H
|
||||
|
||||
#include <vector>
|
||||
#include "common/buses/DeviceLocatorInterface.h"
|
||||
|
||||
namespace seabreeze {
|
||||
|
||||
class DeviceLocationProberInterface {
|
||||
public:
|
||||
virtual ~DeviceLocationProberInterface() = 0;
|
||||
|
||||
/* Report how many devices of this type are available */
|
||||
virtual std::vector<DeviceLocatorInterface *> *probeDevices() = 0;
|
||||
|
||||
protected:
|
||||
DeviceLocationProberInterface();
|
||||
};
|
||||
|
||||
/* Default implementation for (otherwise) pure virtual destructor */
|
||||
inline DeviceLocationProberInterface::~DeviceLocationProberInterface() {}
|
||||
|
||||
}
|
||||
|
||||
#endif /* DEVICELOCATIONPROBERINTERFACE_H */
|
@ -0,0 +1,82 @@
|
||||
/***************************************************//**
|
||||
* @file DeviceLocatorInterface.h
|
||||
* @date February 2012
|
||||
* @author Ocean Optics, Inc.
|
||||
*
|
||||
* DeviceLocatorInterface provides a base interface for
|
||||
* classes that allow the location of a device to be
|
||||
* specified in a bus-specific way. For instance, a
|
||||
* USB DeviceLocator might include a device path or
|
||||
* index, and a socket DeviceLocator might include an
|
||||
* IP address and port number. This allows
|
||||
* devices that cannot be identified by probing to still
|
||||
* be found easily.
|
||||
*
|
||||
* 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 DEVICELOCATORINTERFACE_H
|
||||
#define DEVICELOCATORINTERFACE_H
|
||||
|
||||
#include <string>
|
||||
#include "common/buses/BusFamily.h"
|
||||
|
||||
namespace seabreeze {
|
||||
|
||||
class DeviceLocatorInterface {
|
||||
public:
|
||||
virtual ~DeviceLocatorInterface() = 0;
|
||||
|
||||
/**
|
||||
* Get a unique identifier for this location. This can be any value
|
||||
* as long as it is globally unique.
|
||||
*/
|
||||
virtual unsigned long getUniqueLocation() const = 0;
|
||||
|
||||
/**
|
||||
* Determine whether this DeviceLocator refers to the same device
|
||||
* as another.
|
||||
*/
|
||||
virtual bool equals(DeviceLocatorInterface &that) = 0;
|
||||
|
||||
/**
|
||||
* Get a human-readable string that describes the location
|
||||
*/
|
||||
virtual std::string getDescription() = 0;
|
||||
|
||||
/**
|
||||
* Get a description of the type of bus that the device is associated with
|
||||
*/
|
||||
virtual BusFamily getBusFamily() const = 0;
|
||||
|
||||
/* Get an exact copy of this instance */
|
||||
virtual DeviceLocatorInterface *clone() const = 0;
|
||||
};
|
||||
|
||||
/* Default implementation for (otherwise) pure virtual destructor */
|
||||
inline DeviceLocatorInterface::~DeviceLocatorInterface() {}
|
||||
|
||||
}
|
||||
|
||||
#endif /* DEVICELOCATORINTERFACE_H */
|
@ -0,0 +1,58 @@
|
||||
/***************************************************//**
|
||||
* @file TransferHelper.h
|
||||
* @date February 2009
|
||||
* @author Ocean Optics, Inc.
|
||||
*
|
||||
* This is effectively an interface for wrappers around bus
|
||||
* activity. These wrappers may be selected from a Bus
|
||||
* based on certain hints provided by a Protocol or its
|
||||
* various Exchanges. All that this specifies is that a
|
||||
* given object must be able to send() and receive() data
|
||||
* across its particular (encapsulated) Bus.
|
||||
*
|
||||
* 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_TRANSFERHELPER_H
|
||||
#define SEABREEZE_TRANSFERHELPER_H
|
||||
|
||||
#include "common/SeaBreeze.h"
|
||||
#include "common/exceptions/BusTransferException.h"
|
||||
#include <vector>
|
||||
|
||||
namespace seabreeze {
|
||||
|
||||
class TransferHelper {
|
||||
public:
|
||||
TransferHelper();
|
||||
virtual ~TransferHelper();
|
||||
virtual int receive(std::vector<byte> &buffer, unsigned int length)
|
||||
throw (BusTransferException) = 0;
|
||||
virtual int send(const std::vector<byte> &buffer, unsigned int length) const
|
||||
throw (BusTransferException) = 0;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,75 @@
|
||||
/***************************************************//**
|
||||
* @file IPv4NetworkProtocol.h
|
||||
* @date February 2016
|
||||
* @author Ocean Optics, Inc.
|
||||
*
|
||||
* LICENSE:
|
||||
*
|
||||
* SeaBreeze Copyright (C) 2016, 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_IPV4NETWORKPROTOCOL_H
|
||||
#define SEABREEZE_IPV4NETWORKPROTOCOL_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace seabreeze {
|
||||
class IPv4NetworkProtocol {
|
||||
public:
|
||||
virtual ~IPv4NetworkProtocol();
|
||||
virtual std::string getName() const;
|
||||
virtual bool equals(const IPv4NetworkProtocol &that) const;
|
||||
|
||||
protected:
|
||||
IPv4NetworkProtocol(std::string name, int id);
|
||||
|
||||
private:
|
||||
std::string protocolName;
|
||||
int type;
|
||||
};
|
||||
|
||||
class TCP_IPv4 : public IPv4NetworkProtocol {
|
||||
public:
|
||||
TCP_IPv4();
|
||||
virtual ~TCP_IPv4();
|
||||
};
|
||||
|
||||
class UDP_IPv4 : public IPv4NetworkProtocol {
|
||||
public:
|
||||
UDP_IPv4();
|
||||
virtual ~UDP_IPv4();
|
||||
};
|
||||
|
||||
class IPv4NetworkProtocols {
|
||||
public:
|
||||
const TCP_IPv4 TCP_IP4;
|
||||
const UDP_IPv4 UDP_IP4;
|
||||
|
||||
IPv4NetworkProtocols();
|
||||
~IPv4NetworkProtocols();
|
||||
std::vector<IPv4NetworkProtocol *> getAllIPv4NetworkProtocols();
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* SEABREEZE_IPV4NETWORKPROTOCOL_H */
|
||||
|
@ -0,0 +1,66 @@
|
||||
/***************************************************//**
|
||||
* @file IPv4SocketDeviceLocator.h
|
||||
* @date February 2016
|
||||
* @author Ocean Optics, Inc.
|
||||
*
|
||||
* LICENSE:
|
||||
*
|
||||
* SeaBreeze Copyright (C) 2016, 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_IPV4SOCKETDEVICELOCATOR_H
|
||||
#define SEABREEZE_IPV4SOCKETDEVICELOCATOR_H
|
||||
|
||||
#include "common/buses/DeviceLocatorInterface.h"
|
||||
#include "common/buses/network/IPv4NetworkProtocol.h"
|
||||
#include <string>
|
||||
|
||||
namespace seabreeze {
|
||||
class IPv4SocketDeviceLocator : public DeviceLocatorInterface {
|
||||
public:
|
||||
IPv4SocketDeviceLocator(const IPv4NetworkProtocol &proto, std::string ip,
|
||||
int portNumber);
|
||||
virtual ~IPv4SocketDeviceLocator();
|
||||
|
||||
std::string getIPv4Address();
|
||||
int getPort();
|
||||
IPv4NetworkProtocol getIPv4NetworkProtocol();
|
||||
|
||||
/* Inherited from DeviceLocatorInterface */
|
||||
virtual unsigned long getUniqueLocation() const;
|
||||
virtual bool equals(DeviceLocatorInterface &that);
|
||||
virtual std::string getDescription();
|
||||
virtual BusFamily getBusFamily() const;
|
||||
virtual DeviceLocatorInterface *clone() const;
|
||||
|
||||
protected:
|
||||
unsigned long computeLocationHash();
|
||||
|
||||
IPv4NetworkProtocol protocol;
|
||||
std::string ipAddr;
|
||||
int port;
|
||||
unsigned long locationHash;
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* SEABREEZE_IPV4SOCKETDEVICELOCATOR_H */
|
||||
|
@ -0,0 +1,75 @@
|
||||
/***************************************************//**
|
||||
* @file TCPIPv4SocketBus.h
|
||||
* @date February 2016
|
||||
* @author Ocean Optics, Inc.
|
||||
*
|
||||
* LICENSE:
|
||||
*
|
||||
* SeaBreeze Copyright (C) 2016, 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_TCPIPV4SOCKETBUS_H
|
||||
#define SEABREEZE_TCPIPV4SOCKETBUS_H
|
||||
|
||||
#include "common/buses/Bus.h"
|
||||
#include "common/exceptions/IllegalArgumentException.h"
|
||||
#include "native/network/Socket.h"
|
||||
#include <vector>
|
||||
|
||||
namespace seabreeze {
|
||||
class TCPIPv4SocketBus : public Bus {
|
||||
public:
|
||||
TCPIPv4SocketBus();
|
||||
virtual ~TCPIPv4SocketBus();
|
||||
|
||||
virtual Socket *getSocketDescriptor();
|
||||
|
||||
virtual BusFamily getBusFamily() const;
|
||||
|
||||
virtual void setLocation(const DeviceLocatorInterface &location)
|
||||
throw (IllegalArgumentException);
|
||||
virtual DeviceLocatorInterface *getLocation();
|
||||
virtual TransferHelper *getHelper(
|
||||
const std::vector<ProtocolHint *> &hints) const;
|
||||
|
||||
/* Pure virtual methods */
|
||||
virtual bool open() = 0;
|
||||
virtual void close() = 0;
|
||||
|
||||
|
||||
protected:
|
||||
void addHelper(ProtocolHint *hint, TransferHelper *helper);
|
||||
void clearHelpers();
|
||||
|
||||
Socket *socket;
|
||||
DeviceLocatorInterface *deviceLocator;
|
||||
|
||||
/* These vectors should really be in a map, but that didn't want to
|
||||
* work easily. Since there will likely be about 2 entries in here,
|
||||
* storing in a pair of vectors for now won't hurt anything.
|
||||
*/
|
||||
std::vector<ProtocolHint *> helperKeys;
|
||||
std::vector<TransferHelper *> helperValues;
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* SEABREEZE_TCPIPV4SOCKETBUS_H */
|
@ -0,0 +1,52 @@
|
||||
/***************************************************//**
|
||||
* @file TCPIPv4SocketTransferHelper.h
|
||||
* @date February 2016
|
||||
* @author Ocean Optics, Inc.
|
||||
*
|
||||
* LICENSE:
|
||||
*
|
||||
* SeaBreeze Copyright (C) 2016, 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_TCPIPV4SOCKETTRANSFERHELPER_H
|
||||
#define SEABREEZE_TCPIPV4SOCKETTRANSFERHELPER_H
|
||||
|
||||
#include "common/buses/TransferHelper.h"
|
||||
#include "native/network/Socket.h"
|
||||
|
||||
namespace seabreeze {
|
||||
class TCPIPv4SocketTransferHelper : public TransferHelper {
|
||||
public:
|
||||
TCPIPv4SocketTransferHelper(Socket *sock);
|
||||
virtual ~TCPIPv4SocketTransferHelper();
|
||||
|
||||
virtual int receive(std::vector<byte> &buffer, unsigned int length)
|
||||
throw (BusTransferException);
|
||||
virtual int send(const std::vector<byte> &buffer, unsigned int length) const
|
||||
throw (BusTransferException);
|
||||
|
||||
protected:
|
||||
Socket *socket;
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* SEABREEZE_TCPIPV4SOCKETTRANSFERHELPER_H */
|
@ -0,0 +1,65 @@
|
||||
/***************************************************//**
|
||||
* @file RS232DeviceLocator.h
|
||||
* @date February 2012
|
||||
* @author Ocean Optics, Inc.
|
||||
*
|
||||
* This class encapsulates the information needed to open
|
||||
* a device on an RS232 bus.
|
||||
*
|
||||
* 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 RS232DEVICELOCATOR_H
|
||||
#define RS232DEVICELOCATOR_H
|
||||
|
||||
#include "common/buses/DeviceLocatorInterface.h"
|
||||
#include <string>
|
||||
|
||||
namespace seabreeze {
|
||||
|
||||
class RS232DeviceLocator : public DeviceLocatorInterface {
|
||||
public:
|
||||
RS232DeviceLocator(std::string devicePath, int baudRate);
|
||||
virtual ~RS232DeviceLocator();
|
||||
|
||||
std::string &getDevicePath();
|
||||
int getBaudRate();
|
||||
|
||||
/* Inherited from DeviceLocatorInterface */
|
||||
virtual unsigned long getUniqueLocation() const;
|
||||
virtual bool equals(DeviceLocatorInterface &that);
|
||||
virtual std::string getDescription();
|
||||
virtual BusFamily getBusFamily() const;
|
||||
virtual DeviceLocatorInterface *clone() const;
|
||||
|
||||
private:
|
||||
void computeLocationHash();
|
||||
std::string devicePath;
|
||||
int baudRate;
|
||||
unsigned long locationHash;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* RS232DEVICELOCATOR_H */
|
@ -0,0 +1,63 @@
|
||||
/***************************************************//**
|
||||
* @file RS232Interface.h
|
||||
* @date April 2011
|
||||
* @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 RS232INTERFACE_H
|
||||
#define RS232INTERFACE_H
|
||||
|
||||
#include "common/buses/Bus.h"
|
||||
#include "native/rs232/NativeRS232.h"
|
||||
#include "native/rs232/RS232.h"
|
||||
#include "common/exceptions/IllegalArgumentException.h"
|
||||
|
||||
namespace seabreeze {
|
||||
|
||||
class RS232Interface : public Bus {
|
||||
public:
|
||||
RS232Interface();
|
||||
virtual ~RS232Interface();
|
||||
virtual RS232 *getRS232Descriptor();
|
||||
virtual DeviceLocatorInterface *getLocation();
|
||||
virtual void setLocation(const DeviceLocatorInterface &location)
|
||||
throw (IllegalArgumentException);
|
||||
virtual BusFamily getBusFamily() const;
|
||||
|
||||
/* Pure virtual methods */
|
||||
virtual TransferHelper *getHelper(
|
||||
const std::vector<ProtocolHint *> &hints) const = 0;
|
||||
virtual bool open() = 0;
|
||||
virtual void close() = 0;
|
||||
|
||||
protected:
|
||||
RS232 *rs232;
|
||||
DeviceLocatorInterface *deviceLocator;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* RS232INTERFACE_H */
|
@ -0,0 +1,65 @@
|
||||
/***************************************************//**
|
||||
* @file RS232TransferHelper.h
|
||||
* @date April 2011
|
||||
* @author Ocean Optics, Inc.
|
||||
*
|
||||
* This provides an abstraction around the RS232 bus.
|
||||
* RS232 is pretty simple once the port is opened and
|
||||
* configured, so this mostly just takes care of ensuring
|
||||
* that all bytes are sent and received as required.
|
||||
*
|
||||
* This will effectively block on reads and writes until
|
||||
* they are complete. A non-blocking transfer helper
|
||||
* could be created to complement this if there was
|
||||
* some need, but it is not clear who would be responsible
|
||||
* for delayed reads or retransmits.
|
||||
*
|
||||
* 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 RS232TRANSFERHELPER_H
|
||||
#define RS232TRANSFERHELPER_H
|
||||
|
||||
#include "common/buses/TransferHelper.h"
|
||||
#include "native/rs232/RS232.h"
|
||||
|
||||
namespace seabreeze {
|
||||
|
||||
class RS232TransferHelper : public TransferHelper {
|
||||
public:
|
||||
RS232TransferHelper(RS232 *rs232Descriptor);
|
||||
virtual ~RS232TransferHelper();
|
||||
|
||||
virtual int receive(std::vector<byte> &buffer, unsigned int length)
|
||||
throw (BusTransferException);
|
||||
virtual int send(const std::vector<byte> &buffer, unsigned int length) const
|
||||
throw (BusTransferException);
|
||||
|
||||
protected:
|
||||
RS232 *rs232;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* USBTRANSFERHELPER_H */
|
@ -0,0 +1,59 @@
|
||||
/***************************************************//**
|
||||
* @file USBDeviceLocator.h
|
||||
* @date February 2012
|
||||
* @author Ocean Optics, Inc.
|
||||
*
|
||||
* This class encapsulates the information needed to open
|
||||
* a device on a USB bus.
|
||||
*
|
||||
* 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 USBDEVICELOCATOR_H
|
||||
#define USBDEVICELOCATOR_H
|
||||
|
||||
#include "common/buses/DeviceLocatorInterface.h"
|
||||
#include <string>
|
||||
|
||||
namespace seabreeze {
|
||||
|
||||
class USBDeviceLocator : public DeviceLocatorInterface {
|
||||
public:
|
||||
USBDeviceLocator(unsigned long ID);
|
||||
virtual ~USBDeviceLocator();
|
||||
|
||||
/* Inherited from DeviceLocatorInterface */
|
||||
virtual unsigned long getUniqueLocation() const;
|
||||
virtual bool equals(DeviceLocatorInterface &that);
|
||||
virtual std::string getDescription();
|
||||
virtual BusFamily getBusFamily() const;
|
||||
virtual DeviceLocatorInterface *clone() const;
|
||||
|
||||
private:
|
||||
unsigned long deviceID;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* USBDEVICELOCATOR_H */
|
@ -0,0 +1,64 @@
|
||||
/***************************************************//**
|
||||
* @file USBInterface.h
|
||||
* @date February 2009
|
||||
* @author Ocean Optics, Inc.
|
||||
*
|
||||
* This is an abstract base class intended to be an interface
|
||||
* for USB control objects. This allows USB devices to
|
||||
* be opened generically (just by providing the index of
|
||||
* the device on the bus) without any concern for
|
||||
* the vendor ID, product ID, or underlying USB implementation.
|
||||
*
|
||||
* 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 USBINTERFACE_H
|
||||
#define USBINTERFACE_H
|
||||
|
||||
#include "common/buses/Bus.h"
|
||||
#include "native/usb/NativeUSB.h"
|
||||
#include "native/usb/USB.h"
|
||||
#include "common/exceptions/IllegalArgumentException.h"
|
||||
|
||||
namespace seabreeze {
|
||||
|
||||
class USBInterface : public Bus {
|
||||
public:
|
||||
USBInterface();
|
||||
virtual ~USBInterface();
|
||||
virtual USB *getUSBDescriptor() const;
|
||||
virtual DeviceLocatorInterface *getLocation();
|
||||
virtual void setLocation(const DeviceLocatorInterface &location) throw (IllegalArgumentException);
|
||||
virtual BusFamily getBusFamily() const;
|
||||
virtual bool open() = 0;
|
||||
virtual void close() = 0;
|
||||
|
||||
protected:
|
||||
USB *usb;
|
||||
DeviceLocatorInterface *deviceLocator;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* USBINTERFACE_H */
|
@ -0,0 +1,66 @@
|
||||
/***************************************************//**
|
||||
* @file USBTransferHelper.h
|
||||
* @date February 2009
|
||||
* @author Ocean Optics, Inc.
|
||||
*
|
||||
* This is a TransferHelper intended for USB communications.
|
||||
* Each USBTransferHelper must specify a sending and
|
||||
* receiving endpoint, which will tend to vary according to
|
||||
* the type of data transfer being conducted. This adapts
|
||||
* the send() and receive() methods required of a TransferHelper
|
||||
* according to a particular type of transfer, which may be
|
||||
* inferred from a ProtocolHint.
|
||||
*
|
||||
* 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 USBTRANSFERHELPER_H
|
||||
#define USBTRANSFERHELPER_H
|
||||
|
||||
#include "common/buses/TransferHelper.h"
|
||||
#include "native/usb/USB.h"
|
||||
|
||||
namespace seabreeze {
|
||||
|
||||
class USBTransferHelper : public TransferHelper {
|
||||
public:
|
||||
USBTransferHelper(USB *usbDescriptor, int sendEndpoint,
|
||||
int receiveEndpoint);
|
||||
USBTransferHelper(USB *usbDescriptor);
|
||||
virtual ~USBTransferHelper();
|
||||
|
||||
virtual int receive(std::vector<byte> &buffer, unsigned int length)
|
||||
throw (BusTransferException);
|
||||
virtual int send(const std::vector<byte> &buffer, unsigned int length) const
|
||||
throw (BusTransferException);
|
||||
|
||||
protected:
|
||||
USB *usb;
|
||||
int sendEndpoint;
|
||||
int receiveEndpoint;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* USBTRANSFERHELPER_H */
|
Reference in New Issue
Block a user