Commit 1cc45331 authored by kirov's avatar kirov

+ Added SIP interface for the Frelon (not finished yet)



git-svn-id: https://scm.blissgarden.org/svn/lima/trunk@136 45c4679d-1946-429d-baad-37912b19538b
parent bd01d249
namespace Frelon
{
%TypeHeaderCode
#include "Frelon.h"
#include "MiscUtils.h"
%End
enum Reg {
NbFrames, ExpTime, ShutCloseTime, LatencyTime,
RoiLineBegin, RoiLineWidth, RoiPixelBegin, RoiPixelWidth,
ChanMode, TimeUnit, RoiEnable, RoiFast,
AntiBloom, BinVert, BinHorz, ConfigHD,
RoiKinetic, ShutEnable, HardTrigDisable,
PixelFreq, LineFreq, Flip, IntCalib,
DisplayImage, AdcFloatDiode, AdcSignal,
DarkPixelCalib, DarkPixelMode, ChanControl, Mire,
AoiLineBegin, AoiLineWidth, AoiPixelBegin, AoiPixelWidth,
AoiImageHeight, AoiImageWidth, ChanOnImage, ChanOnCcd,
Version, CompSerNb, Warn,
};
/*
typedef std::map<Reg, std::string> RegStrMapType;
extern RegStrMapType RegStrMap;
enum Cmd {
Reset, Start, Stop, Save,
};
typedef std::map<Cmd, std::string> CmdStrMapType;
extern CmdStrMapType CmdStrMap;
enum MultiLineCmd {
Help, Config, Dac, Volt,
Aoi,
};
typedef std::map<MultiLineCmd, std::string> MultiLineCmdStrMapType;
extern MultiLineCmdStrMapType MultiLineCmdStrMap;
*/
enum FrameTransferMode {
FFM = 0, FTM = 1,
};
enum InputChan {
Chan1 = 1 /*(1 << 0)*/,
Chan2 = 2 /*(1 << 1)*/,
Chan3 = 4 /*(1 << 2)*/,
Chan4 = 8 /*(1 << 3)*/,
Chan13 = 5 /*Chan1 | Chan3*/,
Chan24 = 10 /*Chan2 | Chan4*/,
Chan12 = 3 /*Chan1 | Chan2*/,
Chan34 = 12 /*Chan3 | Chan4*/,
Chan1234 = 15 /*Chan12 | Chan34*/,
};
/*
typedef std::pair<int, int> ChanRange;
typedef std::map<FrameTransferMode, ChanRange> FTMChanRangeMapType;
extern FTMChanRangeMapType FTMChanRangeMap;
typedef std::vector<InputChan> InputChanList;
typedef std::map<FrameTransferMode, InputChanList> FTMInputChanListMapType;
extern FTMInputChanListMapType FTMInputChanListMap;
enum SerNbParam {
SerNb = 0x00ff,
F4M = 0x2000,
F2k16 = 0x4000,
Taper = 0x8000,
};
*/
enum RoiMode {
None, Slow, Fast, Kinetic,
};
/*
enum TimeUnitFactor {
Milliseconds, Microseconds,
};
typedef std::map<TimeUnitFactor, double> TimeUnitFactorMapType;
extern TimeUnitFactorMapType TimeUnitFactorMap;
extern const FrameDim MaxFrameDim;
enum ChipType {
Atmel,
Kodak,
};
typedef std::map<ChipType, double> ChipPixelSizeMapType;
extern ChipPixelSizeMapType ChipPixelSizeMap;
enum {
MaxBinX = 8,
MaxBinY = 1024,
};
*/
enum Status {
Wait = 0x80,
Transfer = 0x40,
Exposure = 0x20,
Shutter = 0x10,
Readout = 0x08,
Latency = 0x04,
ExtStart = 0x02,
ExtStop = 0x01,
};
}; // namespace Frelon
namespace Frelon
{
class Camera
{
%TypeHeaderCode
#include "FrelonCamera.h"
#include "RegEx.h"
#include "MiscUtils.h"
#include <sstream>
%End
public:
Camera(Espia::SerialLine& espia_ser_line);
Espia::SerialLine& getSerialLine();
void writeRegister(Frelon::Reg reg, int val);
void readRegister (Frelon::Reg reg, int& val /Out/);
void hardReset();
void getVersion(std::string& ver /Out/);
void getComplexSerialNb(int& complex_ser_nb /Out/);
void getSerialNb(int& ser_nb /Out/);
void isFrelon2k16(bool& is_frelon_2k16 /Out/);
void isFrelon4M(bool& is_frelon_4m /Out/);
void hasTaper(bool& has_taper /Out/);
void setInputChan(Frelon::InputChan input_chan);
void getInputChan(Frelon::InputChan& input_chan /Out/);
void setFrameTransferMode(Frelon::FrameTransferMode ftm);
void getFrameTransferMode(Frelon::FrameTransferMode& ftm /Out/);
void getFrameDim(FrameDim& frame_dim /Out/);
bool isChanActive(Frelon::InputChan chan);
void setFlip(const Point& flip);
void getFlip(Point& flip /Out/);
void checkBin(Bin& bin /InOut/);
void setBin(const Bin& bin);
void getBin(Bin& bin /Out/);
void setRoiMode(Frelon::RoiMode roi_mode);
void getRoiMode(Frelon::RoiMode& roi_mode /Out/);
void checkRoi(const Roi& set_roi, Roi& hw_roi /Out/);
void setRoi(const Roi& set_roi);
void getRoi(Roi& hw_roi /Out/);
void setTrigMode(TrigMode trig_mode);
void getTrigMode(TrigMode& trig_mode /Out/);
void setExpTime(double exp_time);
void getExpTime(double& exp_time /Out/);
void setLatTime(double lat_time);
void getLatTime(double& lat_time /Out/);
void setNbFrames(int nb_frames);
void getNbFrames(int& nb_frames /Out/);
void getStatus(Frelon::Status& status /Out/);
bool waitStatus(Frelon::Status& status /InOut/, double timeout = 0);
void start();
void stop();
};
}; // namespace Frelon
namespace Frelon
{
class SerialLine : HwSerialLine
{
%TypeHeaderCode
#include "FrelonSerialLine.h"
#include "RegEx.h"
#include "MiscUtils.h"
#include <sstream>
%End
public:
enum MsgPart {
MsgSync, MsgCmd, MsgVal, MsgReq, MsgTerm,
};
enum AnsPart {
AnsResp, AnsWarn, AnsErr,
};
enum {
MaxReadLen = 10000,
};
// typedef std::map<MsgPart, std::string> MsgPartStrMapType;
// static const double TimeoutSingle, TimeoutNormal, TimeoutMultiLine,
// TimeoutReset;
SerialLine(Espia::SerialLine& espia_ser_line);
Espia::SerialLine& getEspiaSerialLine();
virtual void write(const std::string& buffer,
bool no_wait = false);
virtual void read(std::string& buffer /Out/,
int max_len = MaxReadLen,
double timeout = HwSerialLine::TimeoutDefault);
virtual void readStr(std::string& buffer /Out/, int max_len,
const std::string& term,
double timeout = HwSerialLine::TimeoutDefault);
virtual void readLine(std::string& buffer /Out/,
int max_len = MaxReadLen,
double timeout = HwSerialLine::TimeoutDefault);
virtual void readSingleLine(std::string& buffer /Out/,
int max_len = MaxReadLen,
double timeout = HwSerialLine::TimeoutDefault);
virtual void readMultiLine(std::string& buffer /Out/,
int max_len = MaxReadLen);
virtual void flush();
virtual void getNbAvailBytes(int &avail /Out/);
virtual void setTimeout(double timeout);
virtual void getTimeout(double& timeout /Out/) const;
// void splitMsg(const std::string& msg,
// MsgPartStrMapType& msg_parts) const;
void decodeFmtResp(const std::string& ans, std::string& fmt_resp /Out/);
void sendFmtCmd(const std::string& cmd, std::string& resp /Out/);
int getLastWarning();
};
}; // namespace Frelon
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment