Commit 9fe527e6 authored by ahoms's avatar ahoms
Browse files

* changed Espia enums to signed integer values;

  using unsigned SCDXIPCI constants in espia_lib calls
* removed warning in EspiaSerialLine constructor
* unified all directory Makefiles to use global.inc
  with common sub-dirs all/clean targets
* implemented detection of Espia driver directories 
  depending on the platform by including espia.inc;
  limit compilation to suse82 and redhate5/x86_64
* started Frelon code development


git-svn-id: https://scm.blissgarden.org/svn/lima/trunk@69 45c4679d-1946-429d-baad-37912b19538b
parents
sub-dirs = src test
include ../../global.inc
#ifndef FRELON_H
#define FRELON_H
#include "EspiaSerialLine.h"
#include <string>
#include <map>
namespace lima
{
class Frelon
{
public:
enum Reg {
NrFrames, 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, SerNr, Warn,
};
enum Cmd {
Reset, Start, Stop, Save,
};
enum MultiLineCmd {
Help, Config, Dac, Volt,
Aoi,
};
class SerialLine : public HwSerialLine
{
public:
enum MsgPart {
MsgSync, MsgCmd, MsgVal, MsgReq, MsgTerm,
};
SerialLine(EspiaSerialLine& espia_ser_line);
virtual void write(const std::string& buffer,
bool no_wait = false);
virtual void read(std::string& buffer, int len,
double timeout);
virtual void readStr(std::string& buffer, int len,
double timeout);
virtual void getNumAvailBytes(int &avail);
void splitMsg(const std::string& msg,
std::map<MsgPart, std::string>& msg_parts);
private:
EspiaSerialLine& m_espia_ser_line;
bool m_multi_line_cmd;
};
Frelon(EspiaSerialLine& espia_ser_line);
private:
SerialLine m_ser_line;
};
} // namespace lima
#endif // FRELON_H
#include "Frelon.h"
#include "RegEx.h"
using namespace lima;
using namespace std;
#define FRELON_SINGLE_SER_TIMEOUT 0.5
#define FRELON_NORM_SER_TIMEOUT 1.5
#define FRELON_MAX_SER_TIMEOUT 2.0
#define FRELON_RESET_SER_TIMEOUT 5.0
Frelon::SerialLine::SerialLine(EspiaSerialLine& espia_ser_line)
: m_espia_ser_line(espia_ser_line)
{
m_espia_ser_line.setLineTerm("\r\n");
m_espia_ser_line.setTimeout(FRELON_NORM_SER_TIMEOUT);
m_multi_line_cmd = true;
}
void Frelon::SerialLine::splitMsg(const string& msg,
map<MsgPart, string>& msg_parts)
{
msg_parts.clear();
RegEx re("^(?P<pre>>)?"
"(?P<cmd>[A-Z]+)"
"((?P<req>\\?)|(?P<val>[0-9]+))?"
"(?P<term>[\r\n]+)?$");
RegEx::FullNameMatchType match;
if (!re.matchName(msg, match))
throw LIMA_HW_EXC(InvalidValue, "Invalid Frelon message");
}
Frelon::Frelon(EspiaSerialLine& espia_ser_line)
: m_ser_line(espia_ser_line)
{
}
include ../../common/espia/include/espia.inc
CXXFLAGS = -I../include -I../../common/espia/include \
-I../../../hardware/include -I../../../common/include \
-I$(ESPIA_DRV_INCL) -Wall -pthread
all: clean Frelon.o
clean:
rm -f *.o
frelon-obs = ../src/Frelon.o ../../common/espia/src/Espia.o \
../../../hardware/src/Hw.o ../../../common/src/Common.o
include ../../common/espia/include/espia.inc
LDFLAGS = -pthread -L$(ESPIA_DRV_LIB)
LDLIBS = -lespia
CXXFLAGS = -I../include -I../../common/espia/include \
-I../../../hardware/include -I../../../common/include \
-I$(ESPIA_DRV_INCL) -Wall -pthread
all: clean testfrelon
testfrelon: testfrelon.o $(frelon-objs)
$(CXX) $(LDFLAGS) -o $@ $+ $(LDLIBS)
clean:
rm -f *.o testfrelon
#include "Frelon.h"
#include <iostream>
using namespace lima;
using namespace std;
void test_frelon()
{
}
int main(int argc, char *argv[])
{
try {
test_frelon();
} catch (Exception e) {
cerr << "LIMA Exception: " << e << endl;
}
return 0;
}
Supports Markdown
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