Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
LoCuM_4
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software Control System
Tango devices
BeamDiagnostics
LoCuM_4
Commits
67b4cc0b
Commit
67b4cc0b
authored
4 months ago
by
Jade PHAM
Browse files
Options
Downloads
Patches
Plain Diff
Correction de crash in case equipment not connected
parent
76644752
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/LoCuM_4.cpp
+45
-25
45 additions, 25 deletions
src/LoCuM_4.cpp
src/LoCuM_4.h
+1
-1
1 addition, 1 deletion
src/LoCuM_4.h
with
46 additions
and
26 deletions
src/LoCuM_4.cpp
+
45
−
25
View file @
67b4cc0b
...
...
@@ -214,11 +214,6 @@ void LoCuM_4::delete_device()
// Delete device allocated objects
_proxyDevice
.
reset
();
/*if( _proxyDevice )
{
delete _proxyDevice;
_proxyDevice = 0;
}*/
DELETE_SCALAR_ATTRIBUTE
(
attr_gain_read
);
...
...
@@ -238,6 +233,7 @@ void LoCuM_4::init_device()
DEBUG_STREAM
<<
"LoCuM_4::init_device() create device "
<<
device_name
<<
endl
;
/*----- PROTECTED REGION ID(LoCuM_4::init_device_before) ENABLED START -----*/
set_state
(
Tango
::
INIT
);
_isInited
=
false
;
// Initialization before get_device_property() call
//- initialize the inner appender (first thing to do)
try
...
...
@@ -292,8 +288,17 @@ void LoCuM_4::init_device()
{
set_state
(
Tango
::
ON
);
configure
();
if
(
_response
==
""
)
{
set_state
(
Tango
::
FAULT
);
set_status
(
"Initialization failed - could not communicate with Locum!"
);
return
;
}
restore_saved_properties
();
}
_isInited
=
true
;
DEBUG_STREAM
<<
"LoCuM_4::init_device() END "
<<
endl
;
/*----- PROTECTED REGION END -----*/
// LoCuM_4::init_device
}
...
...
@@ -444,7 +449,8 @@ void LoCuM_4::read_attr_hardware(TANGO_UNUSED(vector<long> &attr_list))
{
DEBUG_STREAM
<<
"LoCuM_4::read_attr_hardware(vector<long> &attr_list) entering... "
<<
endl
;
/*----- PROTECTED REGION ID(LoCuM_4::read_attr_hardware) ENABLED START -----*/
if
(
!
_isInited
)
return
;
// get current Locum config
this
->
get_config
();
...
...
@@ -555,7 +561,8 @@ Tango::DevState LoCuM_4::dev_state()
{
DEBUG_STREAM
<<
"LoCuM_4::State() - "
<<
device_name
<<
endl
;
/*----- PROTECTED REGION ID(LoCuM_4::dev_state) ENABLED START -----*/
if
(
!
_isInited
)
return
get_state
();
Tango
::
DevState
argout
=
Tango
::
UNKNOWN
;
// replace by your own algorithm
// Add your own code
if
(
!
_proxyDevice
)
...
...
@@ -629,6 +636,9 @@ Tango::ConstDevString LoCuM_4::dev_status()
{
DEBUG_STREAM
<<
"LoCuM_4::Status() - "
<<
device_name
<<
endl
;
/*----- PROTECTED REGION ID(LoCuM_4::dev_status) ENABLED START -----*/
if
(
!
_isInited
)
return
Tango
::
DeviceImpl
::
dev_status
();
std
::
string
status
=
_dev_status
;
/*----- PROTECTED REGION END -----*/
// LoCuM_4::dev_status
...
...
@@ -679,11 +689,6 @@ Tango::DevString LoCuM_4::send_locum4_command(Tango::DevString argin)
DEBUG_STREAM
<<
"LoCuM_4::SendLocum4Command() - "
<<
device_name
<<
endl
;
/*----- PROTECTED REGION ID(LoCuM_4::send_locum4_command) ENABLED START -----*/
// Add your own code
// POGO has generated a method core with argout allocation.
// If you would like to use a static reference without copying,
// See "TANGO Device Server Programmer's Manual"
// (chapter : Writing a TANGO DS / Exchanging data)
//------------------------------------------------------------
// DEBUG_STREAM << "LoCuM_4::send_locum4_command(): entering... !" << endl;
...
...
@@ -836,12 +841,13 @@ std::string LoCuM_4::write_read(std::string cmd_to_send,bool reading_expected)
{
try
{
DEBUG_STREAM
<<
"LoCuM_4::write_read:: cmd : "
<<
cmd_to_send
<<
std
::
endl
;
if
(
reading_expected
)
{
//- send command
_proxyDevice
->
command_inout
(
"WriteRead"
,
cmd_to_send
.
c_str
(),
resp
);
DEBUG_STREAM
<<
"LoCuM_4::write_read:: anwser: "
<<
resp
<<
std
::
endl
;
}
else
{
...
...
@@ -849,8 +855,8 @@ std::string LoCuM_4::write_read(std::string cmd_to_send,bool reading_expected)
_proxyDevice
->
command_in
(
"Write"
,
cmd_to_send
.
c_str
());
}
DEBUG_STREAM
<<
"LoCuM_4::write_read:: cmd : "
<<
cmd_to_send
<<
std
::
endl
;
DEBUG_STREAM
<<
"LoCuM_4::write_read:: anwser: "
<<
resp
<<
std
::
endl
;
return
std
::
string
(
resp
);
...
...
@@ -861,7 +867,7 @@ std::string LoCuM_4::write_read(std::string cmd_to_send,bool reading_expected)
ERROR_STREAM
<<
df
<<
std
::
endl
;
set_state
(
Tango
::
UNKNOWN
);
set_status
(
"
No
communication with
proxy device
"
);
set_status
(
"
Error in
communication with
Locum_4
"
);
_proxyDevice
.
reset
();
return
""
;
...
...
@@ -897,13 +903,19 @@ std::string LoCuM_4::write_read(std::string cmd_to_send,bool reading_expected)
if
(
reading_expected
)
{
long
readMode
=
2
;
//- SL_LINE : waits for LF (newline set in device Serial)
try
{
_proxyDevice
->
command_inout
(
"DevSerReadString"
,
readMode
,
resp
);
}
catch
(
Tango
::
DevFailed
&
df
)
{
ERROR_STREAM
<<
df
<<
std
::
endl
;
_DEV_TRY_REACTION
(
_proxyDevice
->
command_inout
(
"DevSerReadString"
,
readMode
,
resp
),
"read the command _response"
,
"LoCuM_4::write_read"
,
set_state
(
Tango
::
FAULT
);
);
set_state
(
Tango
::
UNKNOWN
);
set_status
(
"Error in communication with Locum_4"
);
return
""
;
}
//end catch
}
set_state
(
Tango
::
ON
);
...
...
@@ -1010,7 +1022,10 @@ void LoCuM_4::configure()
DEBUG_STREAM
<<
"LoCuM_4::configure"
<<
std
::
endl
;
//- get locum config
this
->
get_config
();
if
(
_response
==
""
)
{
return
;
}
//- check that range == 1000, S2_value2 == Minus (BIAS voltage source) and HV_value3 == ON
double
range
=
this
->
get_range
(
this
->
_response
);
...
...
@@ -1059,6 +1074,12 @@ double LoCuM_4::get_range(std::string config)
std
::
string
range
(
""
);
int
index_underscore
,
index_comma
;
if
(
config
==
""
)
{
ERROR_STREAM
<<
"No anwser from Locum"
<<
endl
;
return
0
;
}
// config string like "S1_100�A,S2_Plus,HV_OFF,Ext_OFF,Bias+_ON,Auto_OFF,"
index_underscore
=
config
.
find_first_of
(
"_"
,
0
);
...
...
@@ -1094,8 +1115,7 @@ double LoCuM_4::get_range(std::string config)
int
c
=
'0'
;
while
(
::
isdigit
((
unsigned
char
)
c
)
&&
i
<
range
.
size
())
c
=
range
[
++
i
];
//-DEBUG_STREAM << "LoCuM_4::get_range::range token:first non-digit char" << c << std::endl;
//-DEBUG_STREAM << "LoCuM_4::get_range::range token:first non-digit char location" << i << std::endl;
if
(
c
!=
'm'
&&
c
!=
'n'
&&
c
!=
'p'
)
{
c
=
'u'
;
...
...
This diff is collapsed.
Click to expand it.
src/LoCuM_4.h
+
1
−
1
View file @
67b4cc0b
...
...
@@ -327,7 +327,7 @@ private:
bool
_biasDefinedOk
;
//- true if bias property is properly defined
bool
_biasSetAtInit
;
//- true if bias value set at init
bool
_isEthernet
;
bool
_isInited
;
Tango
::
DevVarCharArray
*
_lf
;
//Tango::DeviceProxyHelper * _proxyDevice;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment