Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Instrument Control
NomadSpecialModules
Commits
51d3f654
Commit
51d3f654
authored
Jan 16, 2017
by
yannick legoc
Browse files
removed the binary sending of data for dpp histogram and coincidence
parent
7aaf3691
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/controllers/remotenpp/Module.xml
View file @
51d3f654
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
<controller
class=
"npp::RemoteDPPContext"
/>
<controller
class=
"npp::RemoteDPPContext"
/>
<controller
class=
"npp::RemoteDPPHistogram"
/>
<controller
class=
"npp::RemoteDPPHistogram"
/>
<controller
class=
"npp::RemoteDPPCoincidence"
/>
<controller
class=
"npp::RemoteDPPCoincidence"
/>
<controller
class=
"npp::RemoteDPPTest"
/>
<include
path=
"$(NOMAD_HOME)/../NomadModules/src"
/>
<include
path=
"$(NOMAD_HOME)/../NomadModules/src"
/>
...
...
src/controllers/remotenpp/RemoteDPPCoincidence.cpp
View file @
51d3f654
...
@@ -95,12 +95,14 @@ void RemoteDPPCoincidence::setDetectorControllers(const std::vector<ControllerPt
...
@@ -95,12 +95,14 @@ void RemoteDPPCoincidence::setDetectorControllers(const std::vector<ControllerPt
DPPLiveProcess
::
setDetectorControllers
(
detectorControllers
);
DPPLiveProcess
::
setDetectorControllers
(
detectorControllers
);
/* Do not do it
// register the list mode data
// register the list mode data
int32 index = 0;
int32 index = 0;
for (vector<ControllerPtr<acquisition::DetectorController> >::const_iterator c = detectorControllers.begin(); c != detectorControllers.end(); ++c) {
for (vector<ControllerPtr<acquisition::DetectorController> >::const_iterator c = detectorControllers.begin(); c != detectorControllers.end(); ++c) {
registerUpdater((*c)->listModeData, &RemoteDPPCoincidence::updateListModeData, this, index);
registerUpdater((*c)->listModeData, &RemoteDPPCoincidence::updateListModeData, this, index);
index++;
index++;
}
}
*/
}
}
void
RemoteDPPCoincidence
::
start
()
{
void
RemoteDPPCoincidence
::
start
()
{
...
...
src/controllers/remotenpp/RemoteDPPHistogram.cpp
View file @
51d3f654
...
@@ -77,6 +77,7 @@ void RemoteDPPHistogram::setDetectorControllers(const std::vector<ControllerPtr<
...
@@ -77,6 +77,7 @@ void RemoteDPPHistogram::setDetectorControllers(const std::vector<ControllerPtr<
DPPLiveProcess
::
setDetectorControllers
(
detectorControllers
);
DPPLiveProcess
::
setDetectorControllers
(
detectorControllers
);
/* Do not do it.
// Register the list mode data
// Register the list mode data
int32 index = 0;
int32 index = 0;
for (vector<ControllerPtr<acquisition::DetectorController> >::const_iterator c = detectorControllers.begin(); c != detectorControllers.end(); ++c) {
for (vector<ControllerPtr<acquisition::DetectorController> >::const_iterator c = detectorControllers.begin(); c != detectorControllers.end(); ++c) {
...
@@ -84,7 +85,7 @@ void RemoteDPPHistogram::setDetectorControllers(const std::vector<ControllerPtr<
...
@@ -84,7 +85,7 @@ void RemoteDPPHistogram::setDetectorControllers(const std::vector<ControllerPtr<
(*c)->attach(this);
(*c)->attach(this);
registerUpdater((*c)->listModeData, &RemoteDPPHistogram::updateListModeData, this, index);
registerUpdater((*c)->listModeData, &RemoteDPPHistogram::updateListModeData, this, index);
index++;
index++;
}
}
*/
}
}
void
RemoteDPPHistogram
::
start
()
{
void
RemoteDPPHistogram
::
start
()
{
...
...
src/controllers/remotenpp/RemoteDPPTest.cpp
0 → 100644
View file @
51d3f654
/*
* Nomad Instrument Control Software
*
* Copyright 2011 Institut Laue-Langevin
*
* Licensed under the EUPL, Version 1.1 only (the "License");
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at:
*
* http://joinup.ec.europa.eu/software/page/eupl
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Licence for the specific language governing permissions and
* limitations under the Licence.
*/
#include "RemoteDPPTest.h"
#include <common/base/ServerProperties.h>
#include <boost/thread.hpp>
#include <boost/bind.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/property_tree/json_parser.hpp>
#include <cstdlib>
namespace
npp
{
using
namespace
std
;
using
namespace
common
;
using
namespace
boost
;
using
namespace
cameo
;
using
namespace
lstdpp128
;
using
boost
::
property_tree
::
ptree
;
const
std
::
string
RemoteDPPTest
::
TYPE
=
"remote_dpp_test"
;
RemoteDPPTest
::
RemoteDPPTest
(
const
std
::
string
&
name
)
:
RemoteDPPLiveProcess
(
name
)
{
maxBlock
.
init
(
this
,
SAVE
,
"max_block"
);
refreshTimeS
.
init
(
this
,
SAVE
,
"refresh_time_s"
);
}
RemoteDPPTest
::
RemoteDPPTest
(
const
RemoteDPPTest
&
controller
)
:
RemoteDPPLiveProcess
(
controller
)
{
}
RemoteDPPTest
::~
RemoteDPPTest
()
{
}
void
RemoteDPPTest
::
postConfiguration
()
{
RemoteDPPLiveProcess
::
postConfiguration
();
resetData
();
}
void
RemoteDPPTest
::
setDetectorControllers
(
const
std
::
vector
<
ControllerPtr
<
acquisition
::
DetectorController
>
>
&
detectorControllers
)
{
DPPLiveProcess
::
setDetectorControllers
(
detectorControllers
);
// Register the list mode data
int32
index
=
0
;
for
(
vector
<
ControllerPtr
<
acquisition
::
DetectorController
>
>::
const_iterator
c
=
detectorControllers
.
begin
();
c
!=
detectorControllers
.
end
();
++
c
)
{
// Force the attachment to receive updates
(
*
c
)
->
attach
(
this
);
registerUpdater
((
*
c
)
->
listModeData
,
&
RemoteDPPTest
::
updateListModeData
,
this
,
index
);
index
++
;
}
}
void
RemoteDPPTest
::
start
()
{
cout
<<
"RemoteDPPTest::start"
<<
endl
;
// Need a mutex to avoid having two start at the same time.
{
boost
::
mutex
::
scoped_lock
lock
(
m_mutex
);
resetData
();
// Numor
string
numor
;
size_t
size
=
fileName
().
size
();
if
(
size
<
6
)
{
string
prefix
(
6
-
size
,
'0'
);
numor
=
prefix
+
fileName
();
}
else
{
numor
=
fileName
();
}
string
outputName
=
ServerProperties
::
getInstance
()
->
getNomadDataPath
()
+
"/"
+
numor
+
".lst-test"
;
if
(
m_file
.
is_open
())
{
m_file
.
close
();
}
m_file
.
open
(
outputName
.
c_str
(),
ios
::
binary
);
cout
<<
getName
()
<<
" open "
<<
outputName
<<
endl
;
}
}
void
RemoteDPPTest
::
stop
()
{
if
(
m_file
.
is_open
())
{
m_file
.
close
();
cout
<<
"File "
<<
m_file
<<
" is closed"
<<
endl
;
}
}
void
RemoteDPPTest
::
raz
()
{
resetData
();
}
void
RemoteDPPTest
::
updateListModeData
(
int
index
)
{
if
(
m_file
.
is_open
())
{
int32
size
=
detectorControllers
[
index
]
->
listModeData
.
getSize
();
int32
*
memoryBlock
=
detectorControllers
[
index
]
->
listModeData
();
// Put the array into a string
string
data
(
reinterpret_cast
<
char
*>
(
memoryBlock
),
sizeof
(
int32
)
*
size
);
// Send the data
m_file
<<
data
;
}
}
void
RemoteDPPTest
::
resetData
()
{
}
}
src/controllers/remotenpp/RemoteDPPTest.h
0 → 100644
View file @
51d3f654
/*
* Nomad Instrument Control Software
*
* Copyright 2011 Institut Laue-Langevin
*
* Licensed under the EUPL, Version 1.1 only (the "License");
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at:
*
* http://joinup.ec.europa.eu/software/page/eupl
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Licence for the specific language governing permissions and
* limitations under the Licence.
*/
#ifndef NPP_REMOTEDPPTEST_H
#define NPP_REMOTEDPPTEST_H
#include "RemoteDPPLiveProcess.h"
#include <boost/thread.hpp>
#include <stdint.h>
#include <memory>
#include <fstream>
namespace
npp
{
class
RemoteDPPTest
:
public
RemoteDPPLiveProcess
{
public:
//! Type of controller
static
const
std
::
string
TYPE
;
RemoteDPPTest
(
const
std
::
string
&
name
);
RemoteDPPTest
(
const
RemoteDPPTest
&
controller
);
virtual
~
RemoteDPPTest
();
virtual
void
postConfiguration
();
virtual
void
setDetectorControllers
(
const
std
::
vector
<
ControllerPtr
<
acquisition
::
DetectorController
>
>
&
detectorControllers
);
virtual
void
start
();
virtual
void
stop
();
virtual
void
raz
();
void
updateListModeData
(
int
index
);
private:
void
resetData
();
Property
<
int32
>
maxBlock
;
Property
<
int32
>
refreshTimeS
;
std
::
ofstream
m_file
;
};
}
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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