-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFilterWheel.h
More file actions
82 lines (68 loc) · 2.54 KB
/
FilterWheel.h
File metadata and controls
82 lines (68 loc) · 2.54 KB
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
///////////////////////////////////////////////////////////////////////////////
// FILE: FilterWheel.h
// PROJECT: Micro-Manager
// SUBSYSTEM: DeviceAdapters
//-----------------------------------------------------------------------------
// DESCRIPTION: Implementation of Filter Wheel controlled by Arduino.
//
// AUTHOR: Shirish Goyal, shirish.goyal@gmail.com 09/14/2016
//
// COPYRIGHT: Shirish Goyal, BioCurious, Sunnyvale, 2016
//
// LICENSE: This file is distributed under the BSD license.
// License text is included with the source distribution.
//
// This file is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//
// IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES.
#ifndef _ARDUINOFILTERWHEEL_H_
#define _ARDUINOFILTERWHEEL_H_
#include "../../MMDevice/MMDevice.h"
#include "../../MMDevice/DeviceBase.h"
#include <cstdlib>
#include <string>
#include <map>
#include <math.h>
#include <sstream>
//////////////////////////////////////////////////////////////////////////////
// Error codes
//
#define ERR_UNKNOWN_MODE 102
#define ERR_UNKNOWN_POSITION 103
//////////////////////////////////////////////////////////////////////////////
// ArduinoFilterWheel class
// Simulation of the filter changer (state device)
//////////////////////////////////////////////////////////////////////////////
template <class T>
bool from_string(T& t,
const std::string& s,
std::ios_base& (*f)(std::ios_base&))
{
std::istringstream iss(s);
return !(iss >> f >> t).fail();
}
class ArduinoFilterWheel : public CStateDeviceBase<ArduinoFilterWheel>
{
public:
ArduinoFilterWheel();
~ArduinoFilterWheel();
int Initialize();
int Shutdown();
void GetName(char* pszName) const;
bool Busy();
unsigned long GetNumberOfPositions()const {return numPos_;}
int OnState(MM::PropertyBase* pProp, MM::ActionType eAct);
int OnCOMPort(MM::PropertyBase* pProp, MM::ActionType eAct);
private:
unsigned long numPos_;
bool initialized_;
MM::MMTime changedTime_;
long position_;
std::string port_;
void InitializeFilterWheel();
};
#endif //_ARDUINOFILTERWHEEL_H_