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
4a0dd059
Commit
4a0dd059
authored
Dec 17, 2019
by
yannick legoc
Browse files
Updated D22AutoConfig
parent
c470e175
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/controllers/lss/d22autoconfig/D22AutoConfig.cpp
View file @
4a0dd059
...
...
@@ -39,7 +39,7 @@ const std::string AutoConfig::REMOTE_APPLICATION = "autoconfig";
const
std
::
string
AutoConfig
::
RESPONDER
=
"responder"
;
AutoConfig
::
AutoConfig
(
const
std
::
string
&
name
)
:
ExperimentController
(
name
),
controller
::
St
art
(
this
),
ExperimentController
(
name
),
controller
::
St
oppable
(
this
),
m_countSpy
(
nullptr
)
{
setFamily
(
family
::
ACQUISITION
,
family
::
SETTING
);
...
...
@@ -70,7 +70,7 @@ AutoConfig::AutoConfig(const std::string& name) :
}
AutoConfig
::
AutoConfig
(
const
AutoConfig
&
controller
)
:
ExperimentController
(
controller
),
controller
::
St
art
(
this
),
ExperimentController
(
controller
),
controller
::
St
oppable
(
this
),
m_countSpy
(
nullptr
)
{
}
...
...
@@ -89,6 +89,8 @@ AutoConfig::~AutoConfig() {
void
AutoConfig
::
postConfiguration
()
{
registerProgression
(
m_d22settings
,
&
AutoConfig
::
updateProgression
,
this
);
if
(
m_server
.
get
()
==
nullptr
)
{
// Create a new server if it is not already created.
// In case of a simulated server, avoid the real remote endpoint.
...
...
@@ -222,10 +224,18 @@ float64 AutoConfig::getSampleBackground() {
void
AutoConfig
::
start
()
{
// Start progression.
commandProgression
=
0
;
commandStatus
.
setRunning
();
if
(
!
initApplication
())
{
commandProgression
=
100
;
commandStatus
.
setError
();
return
;
}
commandProgression
=
10
;
// Start date.
Date
begin
;
...
...
@@ -271,6 +281,8 @@ void AutoConfig::start() {
int32
*
data
=
count
->
masterDetector
->
data
();
request
.
set_data
(
string
(
reinterpret_cast
<
const
char
*>
(
data
),
sizeof
(
int32
)
*
xSize
*
ySize
));
log
(
Level
::
s_Debug
)
<<
"Calculate"
<<
endlog
;
// Send the request.
m_requester
->
sendTwoBinaryParts
(
requestType
.
SerializeAsString
(),
request
.
SerializeAsString
());
...
...
@@ -311,11 +323,23 @@ void AutoConfig::start() {
sampleParametersString
+=
autoConfigResponse
.
sampleparameters
(
i
).
type
()
+
" "
+
to_string
(
autoConfigResponse
.
sampleparameters
(
i
).
value
());
sampleParameters
=
sampleParametersString
;
// Intermediate progression.
commandProgression
=
50
;
log
(
Level
::
s_Debug
)
<<
"Apply"
<<
endlog
;
apply
();
// End progression.
commandProgression
=
100
;
commandStatus
.
setIdle
();
log
(
Level
::
s_Info
)
<<
"Finished auto settings"
<<
endlog
;
}
void
AutoConfig
::
apply
()
{
// Set D22Settings.
int32
size
=
resultSize
();
for
(
int
i
=
0
;
i
<
size
;
++
i
)
{
if
(
type
.
get
(
i
)
==
wantedType
())
{
...
...
@@ -336,6 +360,21 @@ void AutoConfig::apply() {
}
}
}
// Start D22Settings.
m_d22settings
->
startCommand
(
true
);
}
void
AutoConfig
::
stop
()
{
m_d22settings
->
stopCommand
();
}
void
AutoConfig
::
updateProgression
()
{
if
(
commandStatus
.
isRunning
())
{
if
(
commandProgression
()
>=
50
)
{
commandProgression
=
50
+
m_d22settings
->
commandProgression
()
/
2
;
}
}
}
}
src/controllers/lss/d22autoconfig/D22AutoConfig.h
View file @
4a0dd059
...
...
@@ -29,7 +29,7 @@
namespace
d22
{
class
AutoConfig
:
public
ExperimentController
,
public
controller
::
St
art
{
public
controller
::
St
oppable
{
public:
//! Type of controller
...
...
@@ -43,7 +43,9 @@ public:
void
apply
();
virtual
void
start
();
virtual
void
stop
();
void
updateProgression
();
Property
<
std
::
string
>
serverEndpoint
;
Property
<
bool
>
initialized
;
...
...
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