Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tango-ds
DeviceClasses
Acquisition
2D
AGIPD
Commits
4f86234b
Commit
4f86234b
authored
Jun 24, 2016
by
Yuelong Yu
Browse files
working commit
added spectrum read out method.
parent
c80c3ac0
Changes
5
Hide whitespace changes
Inline
Side-by-side
agipdmc/AGIPDMC.cpp
View file @
4f86234b
...
...
@@ -42,6 +42,7 @@ static const char *RcsId = "$Id: $";
#include
<AGIPDMC.h>
#include
<AGIPDMCClass.h>
#include
"UpdateDataThread.h"
/*----- PROTECTED REGION END -----*/
// AGIPDMC.cpp
...
...
@@ -125,6 +126,14 @@ void AGIPDMC::delete_device()
/*----- PROTECTED REGION ID(AGIPDMC::delete_device) ENABLED START -----*/
// Delete device allocated objects
{
omni_mutex_lock
l
(
m_mtxData
);
m_bSysExit
=
true
;
}
int
*
nRet
;
m_thData
->
join
((
void
**
)
&
nRet
);
/*----- PROTECTED REGION END -----*/
// AGIPDMC::delete_device
delete
[]
attr_RawMatrix_read
;
...
...
@@ -154,7 +163,32 @@ void AGIPDMC::init_device()
/*----- PROTECTED REGION ID(AGIPDMC::init_device) ENABLED START -----*/
// Initialize device
std
::
fill
(
attr_RawMatrix_read
,
attr_RawMatrix_read
+
6000
,
0
);
m_nDataLength
=
6000
;
m_bSysExit
=
false
;
try
{
m_sptrDP
=
std
::
shared_ptr
<
Tango
::
DeviceProxy
>
(
new
Tango
::
DeviceProxy
(
tTTGWDeviceName
));
m_sptrDP
->
ping
();
usleep
(
100
);
cout
<<
"connects to "
<<
string
(
tTTGWDeviceName
)
<<
endl
;
}
catch
(
exception
&
e
)
{
cout
<<
e
.
what
()
<<
endl
;
exit
(
0
);
}
m_thData
=
new
UpdateDataThread
(
this
,
m_sptrDP
.
get
(),
m_mtxData
);
cout
<<
"start updating data..."
<<
endl
;
set_state
(
Tango
::
MOVING
);
/*----- PROTECTED REGION END -----*/
// AGIPDMC::init_device
}
...
...
@@ -256,7 +290,7 @@ void AGIPDMC::read_RawMatrix(Tango::Attribute &attr)
DEBUG_STREAM
<<
"AGIPDMC::read_RawMatrix(Tango::Attribute &attr) entering... "
<<
endl
;
/*----- PROTECTED REGION ID(AGIPDMC::read_RawMatrix) ENABLED START -----*/
// Set the attribute value
attr
.
set_value
(
attr_RawMatrix_read
,
6000
);
attr
.
set_value
(
attr_RawMatrix_read
,
m_nDataLength
);
/*----- PROTECTED REGION END -----*/
// AGIPDMC::read_RawMatrix
}
...
...
agipdmc/AGIPDMC.h
View file @
4f86234b
...
...
@@ -39,7 +39,7 @@
#define AGIPDMC_H
#include
<tango.h>
#include
<memory>
/*----- PROTECTED REGION END -----*/
// AGIPDMC.h
...
...
@@ -65,7 +65,15 @@ class AGIPDMC : public TANGO_BASE_CLASS
/*----- PROTECTED REGION ID(AGIPDMC::Data Members) ENABLED START -----*/
// Add your own data members
private:
std
::
shared_ptr
<
Tango
::
DeviceProxy
>
m_sptrDP
;
omni_thread
*
m_thData
;
omni_mutex
m_mtxData
;
public:
bool
m_bSysExit
;
int
m_nDataLength
;
/*----- PROTECTED REGION END -----*/
// AGIPDMC::Data Members
// Device property data members
...
...
@@ -194,6 +202,7 @@ public:
// Additional Method prototypes
/*----- PROTECTED REGION END -----*/
// AGIPDMC::Additional Method prototypes
};
...
...
agipdmc/Makefile
View file @
4f86234b
...
...
@@ -20,7 +20,7 @@
#=============================================================================
# MAKE_ENV is the path to find common environment to buil project
#
MAKE_ENV
=
/usr/share/pogo/preferences
MAKE_ENV
=
$(TANGO_DIR)
/Libraries/cppserver/common
#=============================================================================
# PACKAGE_NAME is the name of the library/device/exe you want to build
...
...
@@ -91,7 +91,7 @@ LIB_DIR_USER=
#
# -DACE_HAS_EXCEPTIONS -D__ACE_INLINE__ for ACE
#
#
CXXFLAGS_USR+= -
Wall
CXXFLAGS_USR
+=
-
w
-g
-std
=
c++0x
#=============================================================================
...
...
@@ -119,7 +119,7 @@ include $(MAKE_ENV)/tango.opt
#=============================================================================
# SVC_OBJS is the list of all objects needed to make the output
#
SVC_INCL
=
$(PACKAGE_NAME)
.h
$(PACKAGE_NAME)
Class.h
SVC_INCL
=
$(PACKAGE_NAME)
.h
$(PACKAGE_NAME)
Class.h
UpdateDataThread.h
SVC_OBJS
=
\
...
...
@@ -128,6 +128,7 @@ SVC_OBJS = \
$(OBJDIR)
/
$(PACKAGE_NAME)
StateMachine.o
\
$(OBJDIR)
/ClassFactory.o
\
$(OBJDIR)
/main.o
\
$(OBJDIR)
/UpdateDataThread.o
\
$(ADDITIONAL_OBJS)
SVC_INHERITANCE_OBJ
=
\
...
...
agipdmc/UpdateDataThread.cpp
0 → 100644
View file @
4f86234b
#include
"UpdateDataThread.h"
namespace
AGIPDMC_ns
{
UpdateDataThread
::
UpdateDataThread
(
AGIPDMC
*
_sptrAGIPDMC
,
Tango
::
DeviceProxy
*
_sptrDP
,
omni_mutex
&
_mtxData
)
:
omni_thread
(),
Tango
::
LogAdapter
(
_sptrAGIPDMC
),
m_sptrAGIPDMC
(
_sptrAGIPDMC
),
m_sptrDP
(
_sptrDP
),
m_mtxData
(
_mtxData
)
{
start_undetached
();
}
UpdateDataThread
::~
UpdateDataThread
()
{
}
void
*
UpdateDataThread
::
run_undetached
(
void
*
ptr
)
{
while
(
1
)
{
//usleep(100);
sleep
(
2
);
{
omni_mutex_lock
l
(
m_mtxData
);
if
(
m_sptrAGIPDMC
->
m_bSysExit
)
break
;
ReadOutSpectrum
();
}
}
omni_thread
::
exit
();
}
void
UpdateDataThread
::
ReadOutSpectrum
()
{
cout
<<
"Read out spectrum"
<<
endl
;
}
}
agipdmc/UpdateDataThread.h
0 → 100644
View file @
4f86234b
#ifndef __UPDATE_DATA_THREAD__
#define __UPDATE_DATA_THREAD__
#include
<tango.h>
#include
"AGIPDMC.h"
namespace
AGIPDMC_ns
{
class
UpdateDataThread
:
public
omni_thread
,
public
Tango
::
LogAdapter
{
public:
UpdateDataThread
(
AGIPDMC
*
_sptrAGIPDMC
,
Tango
::
DeviceProxy
*
_sptrDP
,
omni_mutex
&
_mtxData
);
~
UpdateDataThread
();
void
*
run_undetached
(
void
*
);
private:
void
ReadOutSpectrum
();
/// member variables
AGIPDMC
*
m_sptrAGIPDMC
;
Tango
::
DeviceProxy
*
m_sptrDP
;
omni_mutex
&
m_mtxData
;
};
}
#endif
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment