Commit c29ba4e3 authored by Alejandro Homs Puron's avatar Alejandro Homs Puron Committed by Operator for ID00
Browse files

First version of the Python SIP wrapping

parent 082d72b0
############################################################################
# This file is part of LImA, a Library for Image Acquisition
#
# Copyright (C) : 2009-2011
# European Synchrotron Radiation Facility
# BP 220, Grenoble 38043
# FRANCE
#
# This is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This software 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. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
############################################################################
from Lima import module_helper
mod_path = __path__
depends_on = 'Core'
has_dependent = False
cleanup_data = module_helper.load_prepare(mod_path, depends_on, has_dependent)
from Lima import Core
cleanup_data = module_helper.load_dep_cleanup(cleanup_data)
from Lima.SlsDetector.limaslsdetector import SlsDetector as _S
globals().update(_S.__dict__)
module_helper.load_cleanup(cleanup_data)
del _S
del mod_path, depends_on, has_dependent, cleanup_data
del module_helper
//###########################################################################
// This file is part of LImA, a Library for Image Acquisition
//
// Copyright (C) : 2009-2011
// European Synchrotron Radiation Facility
// BP 220, Grenoble 38043
// FRANCE
//
// This is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// This software 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. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, see <http://www.gnu.org/licenses/>.
//###########################################################################
namespace SlsDetector
{
%TypeHeaderCode
#include "SlsDetectorCamera.h"
%End
enum State {
Idle, Init, Starting, Running, StopReq, Stopping, Stopped,
};
class Camera
{
%TypeHeaderCode
#include "SlsDetectorCamera.h"
%End
public:
class FrameMap
{
public:
typedef std::set<int> List;
typedef std::map<int, std::set<int> > Map;
class Callback
{
public:
Callback();
virtual ~Callback();
protected:
virtual void frameFinished(int frame) = 0;
};
FrameMap();
~FrameMap();
void setCallback(Callback *cb);
void setNbItems(int nb_items);
void clear();
void frameItemFinished(int frame, int item);
int getLastSeqFinishedFrame() const;
const SlsDetector::Camera::FrameMap::List&
getNonSeqFinishedFrames() const;
const SlsDetector::Camera::FrameMap::Map&
getFramePendingItemsMap() const;
};
Camera(std::string config_fname);
virtual ~Camera();
void setBufferCbMgr(StdBufferCbMgr *buffer_cb_mgr);
void setSaveRaw(bool save_raw);
void setNbFrames(int nb_frames);
void getNbFrames(int& nb_frames /Out/);
void setExpTime(double exp_time);
void getExpTime(double& exp_time /Out/);
void setFramePeriod(double frame_period);
void getFramePeriod(double& frame_period /Out/);
SlsDetector::State getState();
void waitState(SlsDetector::State state);
SlsDetector::State waitNotState(SlsDetector::State state);
void prepareAcq();
void startAcq();
void stopAcq();
int getNbHalfModules();
void getFrameDim(FrameDim& frame_dim, bool raw = false);
int getFramesCaught();
std::string getStatus();
const SlsDetector::Camera::FrameMap& getRecvMap();
};
}; // namespace SlsDetector
//###########################################################################
// This file is part of LImA, a Library for Image Acquisition
//
// Copyright (C) : 2009-2011
// European Synchrotron Radiation Facility
// BP 220, Grenoble 38043
// FRANCE
//
// This is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// This software 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. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, see <http://www.gnu.org/licenses/>.
//###########################################################################
namespace SlsDetector
{
class EventCallback : EventCallback
{
%TypeHeaderCode
#include "SlsDetectorInterface.h"
%End
public:
EventCallback(HwEventCtrlObj& ctrl_obj);
virtual ~EventCallback();
protected:
virtual void processEvent(Event *event);
};
class DetInfoCtrlObj : HwDetInfoCtrlObj
{
%TypeHeaderCode
#include "SlsDetectorInterface.h"
%End
public:
DetInfoCtrlObj(SlsDetector::Camera& cam);
virtual ~DetInfoCtrlObj();
virtual void getMaxImageSize(Size& max_image_size /Out/);
virtual void getDetectorImageSize(Size& det_image_size /Out/);
virtual void getDefImageType(ImageType& def_image_type /Out/);
virtual void getCurrImageType(ImageType& curr_image_type /Out/);
virtual void setCurrImageType(ImageType curr_image_type);
virtual void getPixelSize(double& x_size /Out/, double& y_size /Out/);
virtual void getDetectorType(std::string& det_type /Out/);
virtual void getDetectorModel(std::string& det_model /Out/);
virtual void registerMaxImageSizeCallback(
HwMaxImageSizeCallback& cb);
virtual void unregisterMaxImageSizeCallback(
HwMaxImageSizeCallback& cb);
};
class SyncCtrlObj : HwSyncCtrlObj
{
%TypeHeaderCode
#include "SlsDetectorInterface.h"
%End
public:
SyncCtrlObj(SlsDetector::Camera& cam);
virtual ~SyncCtrlObj();
virtual bool checkTrigMode(TrigMode trig_mode);
virtual void setTrigMode(TrigMode trig_mode);
virtual void getTrigMode(TrigMode& trig_mode /Out/);
virtual void setExpTime(double exp_time);
virtual void getExpTime(double& exp_time /Out/);
virtual void setLatTime(double lat_time);
virtual void getLatTime(double& lat_time /Out/);
virtual void setNbHwFrames(int nb_frames);
virtual void getNbHwFrames(int& nb_frames /Out/);
virtual void getValidRanges(HwSyncCtrlObj::ValidRangesType& valid_ranges /Out/);
};
class EventCtrlObj : HwEventCtrlObj
{
%TypeHeaderCode
#include "SlsDetectorInterface.h"
%End
public:
EventCtrlObj();
virtual ~EventCtrlObj();
};
class Interface : HwInterface
{
%TypeHeaderCode
#include "SlsDetectorInterface.h"
#include <algorithm>
%End
public:
Interface(SlsDetector::Camera& cam /KeepReference/);
virtual ~Interface();
virtual void getCapList(std::vector<HwCap> &cap_list /Out/) const;
virtual void reset(HwInterface::ResetLevel reset_level);
virtual void prepareAcq();
virtual void startAcq();
virtual void stopAcq();
virtual void getStatus(HwInterface::StatusType& status /Out/);
virtual int getNbHwAcquiredFrames();
void resetDefaults();
SIP_PYOBJECT getHwCtrlObj(HwCap::Type cap_type);
%MethodCode
HwInterface::CapList cap_list;
sipCpp->getCapList(cap_list);
typedef HwInterface::CapList::const_iterator It;
for (It i = cap_list.begin(); i != cap_list.end(); ++i)
if (i->getType() == a0) {
LIMA_CONVERT_HWCAP_TO_SIP_CTRLOBJ(i, HW);
break;
}
%End
};
}; // namespace SlsDetector
......@@ -38,8 +38,8 @@ SLS_DETECTORS_INCL_FLAGS = -I$(SLS_DETECTORS_SW)/include \
-I$(SLS_DETECTORS_SW)/multiSlsDetector \
-I$(SLS_DETECTORS_SW)/slsDetectorServer \
-I$(SLS_DETECTORS_SW)/slsDetectorAnalysis \
-I$(SLS_DETECTORS_RECV)/include \
-I$(SLS_DETECTORS_SW)/slsReceiverInterface
-I$(SLS_DETECTORS_SW)/slsReceiverInterface \
-I$(SLS_DETECTORS_RECV)/include
CXXFLAGS = -I../include $(LIMA_INCL_FLAGS) $(SLS_DETECTORS_INCL_FLAGS) \
......
......@@ -30,17 +30,16 @@ SLS_DETECTORS_BIN = $(SLS_DETECTORS_DIR)/bin
SLS_DETECTORS_SW = $(SLS_DETECTORS_DIR)/slsDetectorSoftware
SLS_DETECTORS_RECV = $(SLS_DETECTORS_DIR)/slsReceiverSoftware
LDFLAGS = -pthread -L$(SLS_DETECTORS_BIN) -L../../../build \
-L../../../third-party/Processlib/build
LDLIBS = -llimaslsdetector -lSlsDetector -lSlsReceiver -llimacore -lprocesslib
LDFLAGS = -pthread -L$(LIMA_DIR)/build
LDLIBS = -llimaslsdetector -llimacore
ifneq ($(COMPILE_CBF_SAVING), 0)
LDFLAGS += -L../../../third-party/CBFLib/lib
LDFLAGS += -L$(LIMA_DIR)/third-party/CBFLib/lib
LDLIBS += -lcbf
endif
ifneq ($(COMPILE_CONFIG), 0)
LDFLAGS += -L../../../third-party/libconfig/lib/.libs
LDFLAGS += -L$(LIMA_DIR)/third-party/libconfig/lib/.libs
LDLIBS += -lconfig++
endif
......
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