1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172
|
/*!
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Copyright(c) 2011 Apogee Imaging Systems, Inc.
*
* \class ApogeeFilterWheel
* \brief class for apogee's usb filter wheel
*
*/
#ifndef APOGEEFILTERWHEEL_INCLUDE_H__
#define APOGEEFILTERWHEEL_INCLUDE_H__
#include <stdint.h>
#include <string>
#include <memory>
#include "DefDllExport.h"
class FilterWheelIo;
class DLL_EXPORT ApogeeFilterWheel
{
public:
/*! */
enum Type
{
/*! */
UNKNOWN_TYPE = 0,
/*! */
FW50_9R = 1,
/*! */
FW50_7S = 2,
/*! */
AFW50_10S = 6,
AFW31_17R = 9
};
/*! Current filter wheel state */
enum Status
{
/*! Error status */
UNKNOWN_STATUS,
/*! Filter wheel is not connected either physically
* or the ApogeeFilterWheel::Init function has not been
called*/
NOT_CONNECTED,
/*! Filter wheel is at the desired position */
READY,
/*! Filter wheel is moving to desired postion*/
ACTIVE
};
/*!
*
*/
ApogeeFilterWheel();
/*!
*
*/
virtual ~ApogeeFilterWheel();
/*!
* Initizes the USB connection from the PC to the filter wheel. The results strings from
* the FindDeviceUsb::Find() provide the input into this function.
* \param [in] User supplied ApogeeFilterWheel::Type
* \param [in] DeviceAddr specifies the address of the filter wheel on the USB buss
* \exception std::runtime_error
*/
void Init( const ApogeeFilterWheel::Type type,
const std::string & DeviceAddr );
/*!
* Closes the USB connection to the filter wheel
* \exception std::runtime_error
*/
void Close();
/*!
* Returns USB vendor id
* \exception std::runtime_error
*/
uint16_t GetVendorId();
/*!
* Returns USB product id
* \exception std::runtime_error
*/
uint16_t GetProductId();
/*!
* Returns USB device id
* \exception std::runtime_error
*/
uint16_t GetDeviceId();
/*!
* Returns USB firmware version
* \exception std::runtime_error
*/
std::string GetUsbFirmwareRev();
/*!
* Returns Current filter wheel type
*/
ApogeeFilterWheel::Type GetType() { return m_type; }
/*!
* Returns Current filter wheel name
* \exception std::runtime_error
*/
std::string GetName();
/*!
* Returns the current status of the filter wheel
* \exception std::runtime_error
*/
ApogeeFilterWheel::Status GetStatus();
/*!
* Returns The maximum number of filter wheel position
* \exception std::runtime_error
*/
uint16_t GetMaxPositions();
/*!
* Sets filter wheel positon
* \param [in] Position Desired position. Valid range is 1 to GetMaxPositions()
* \exception std::runtime_error
*/
void SetPosition( uint16_t Position );
/*!
* Returns the current filter wheel position
* \exception std::runtime_error
*/
uint16_t GetPosition();
protected:
//this code removes vc++ compiler warning C4251
//from http://www.unknownroad.com/rtfm/VisualStudio/warningC4251.html
#ifdef WIN_OS
#if _MSC_VER < 1600
template class DLL_EXPORT std::shared_ptr<FilterWheelIo>;
#endif
#endif
std::shared_ptr<FilterWheelIo> m_Usb;
private:
bool IsConnected();
ApogeeFilterWheel::Type m_type;
bool m_connected;
//disabling the copy ctor and assignment operator
//generated by the compiler - don't want them
//Effective C++ Item 6
ApogeeFilterWheel(const ApogeeFilterWheel&);
ApogeeFilterWheel& operator=(ApogeeFilterWheel&);
};
#endif
|