Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
CryoCooler
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
Temperature
CryoCooler
Commits
5184ad94
Commit
5184ad94
authored
Jun 16, 2022
by
HERCULE
Committed by
Florent LANGLOIS
Jun 16, 2022
Browse files
Options
Downloads
Patches
Plain Diff
[Icathales 190] Fix crash at init
parent
b1fcc6f4
No related branches found
No related tags found
1 merge request
!1
Icathales 190 crash init
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/cryo_support/Parts.cpp
+36
-46
36 additions, 46 deletions
src/cryo_support/Parts.cpp
src/cryo_support/Parts.h
+4
-3
4 additions, 3 deletions
src/cryo_support/Parts.h
with
40 additions
and
49 deletions
src/cryo_support/Parts.cpp
+
36
−
46
View file @
5184ad94
...
@@ -47,8 +47,8 @@ namespace CryoCooler_ns
...
@@ -47,8 +47,8 @@ namespace CryoCooler_ns
HWProxy_ns
::
ComState
Part
::
get_com_state
(
void
)
HWProxy_ns
::
ComState
Part
::
get_com_state
(
void
)
{
{
//DEBUG_STREAM << " Part::get_com_state <- " << std::endl;
//DEBUG_STREAM << " Part::get_com_state <- " << std::endl;
if
(
cryo_itf
)
if
(
cryo_itf
.
get
()
)
this
->
com_state
=
cryo_itf
->
get_com_state
();
this
->
com_state
=
cryo_itf
.
get
()
->
get_com_state
();
else
else
{
{
this
->
com_status
+=
"
\n
last error : Part::get_com_state() cannot get CryoCooler interface pointer ..."
;
this
->
com_status
+=
"
\n
last error : Part::get_com_state() cannot get CryoCooler interface pointer ..."
;
...
@@ -62,10 +62,10 @@ namespace CryoCooler_ns
...
@@ -62,10 +62,10 @@ namespace CryoCooler_ns
std
::
string
Part
::
get_com_status
(
void
)
std
::
string
Part
::
get_com_status
(
void
)
{
{
//DEBUG_STREAM << " Part::get_com_status <- " << std::endl;
//DEBUG_STREAM << " Part::get_com_status <- " << std::endl;
if
(
cryo_itf
)
if
(
cryo_itf
.
get
()
)
{
{
this
->
com_status
=
cryo_itf
->
get_com_status
();
this
->
com_status
=
cryo_itf
.
get
()
->
get_com_status
();
this
->
com_status
+=
"
\n
last error : "
+
this
->
cryo_itf
->
get_last_error
();
this
->
com_status
+=
"
\n
last error : "
+
this
->
cryo_itf
.
get
()
->
get_last_error
();
}
}
else
else
this
->
com_status
=
"Part::get_com_state() cannot get CryoCooler interface pointer ..."
;
this
->
com_status
=
"Part::get_com_state() cannot get CryoCooler interface pointer ..."
;
...
@@ -82,8 +82,8 @@ namespace CryoCooler_ns
...
@@ -82,8 +82,8 @@ namespace CryoCooler_ns
float
tmp
=
__NAN__
;
float
tmp
=
__NAN__
;
try
try
{
{
if
(
cryo_itf
)
if
(
cryo_itf
.
get
()
)
tmp
=
cryo_itf
->
get_real
(
offset
);
tmp
=
cryo_itf
.
get
()
->
get_real
(
offset
);
}
}
catch
(...)
catch
(...)
{
{
...
@@ -102,7 +102,7 @@ namespace CryoCooler_ns
...
@@ -102,7 +102,7 @@ namespace CryoCooler_ns
short
tmp
=
-
1
;
short
tmp
=
-
1
;
try
try
{
{
if
(
cryo_itf
)
if
(
cryo_itf
.
get
()
)
tmp
=
cryo_itf
->
get_int
(
offset
);
tmp
=
cryo_itf
->
get_int
(
offset
);
}
}
catch
(...)
catch
(...)
...
@@ -129,8 +129,8 @@ namespace CryoCooler_ns
...
@@ -129,8 +129,8 @@ namespace CryoCooler_ns
bool
tmp
=
false
;
bool
tmp
=
false
;
try
try
{
{
if
(
cryo_itf
)
if
(
cryo_itf
.
get
()
)
tmp
=
cryo_itf
->
get_bool
(
bit_offset
,
byte_offset
);
tmp
=
cryo_itf
.
get
()
->
get_bool
(
bit_offset
,
byte_offset
);
}
}
catch
(...)
catch
(...)
{
{
...
@@ -166,7 +166,7 @@ namespace CryoCooler_ns
...
@@ -166,7 +166,7 @@ namespace CryoCooler_ns
wr
.
byte_offset
=
offset
;
wr
.
byte_offset
=
offset
;
wr
.
value
=
v
;
wr
.
value
=
v
;
msg
->
attach_data
(
wr
);
msg
->
attach_data
(
wr
);
this
->
cryo_itf
->
post
(
msg
);
this
->
cryo_itf
.
get
()
->
post
(
msg
);
}
}
//- SetBool -----------------------------------------
//- SetBool -----------------------------------------
...
@@ -194,7 +194,7 @@ namespace CryoCooler_ns
...
@@ -194,7 +194,7 @@ namespace CryoCooler_ns
wb
.
bit_offset
=
bit_offset
;
wb
.
bit_offset
=
bit_offset
;
wb
.
value
=
v
;
wb
.
value
=
v
;
msg
->
attach_data
(
wb
);
msg
->
attach_data
(
wb
);
this
->
cryo_itf
->
post
(
msg
);
this
->
cryo_itf
.
get
()
->
post
(
msg
);
}
}
//- SendCmd -----------------------------------------
//- SendCmd -----------------------------------------
...
@@ -216,13 +216,13 @@ namespace CryoCooler_ns
...
@@ -216,13 +216,13 @@ namespace CryoCooler_ns
wi
.
byte_offset
=
offset
;
wi
.
byte_offset
=
offset
;
wi
.
value
=
0
;
wi
.
value
=
0
;
msg
->
attach_data
(
wi
);
msg
->
attach_data
(
wi
);
this
->
cryo_itf
->
post
(
msg
);
this
->
cryo_itf
.
get
()
->
post
(
msg
);
}
}
// ============================================================================
// ============================================================================
//- pseudo singleton
//- pseudo singleton
// ============================================================================
// ============================================================================
CryoCooler_ns
::
CryoCoolerInterface
*
CryoCoolerCom
::
cryo_itf
=
0
;
yat
::
SharedPtr
<
CryoCooler_ns
::
CryoCoolerInterface
>
CryoCoolerCom
::
cryo_itf
;
//---------------------------------------------------------------------
//---------------------------------------------------------------------
//- Cryocooler Class Implementation
//- Cryocooler Class Implementation
...
@@ -283,19 +283,14 @@ namespace CryoCooler_ns
...
@@ -283,19 +283,14 @@ namespace CryoCooler_ns
CryoCoolerCom
::~
CryoCoolerCom
()
CryoCoolerCom
::~
CryoCoolerCom
()
{
{
DEBUG_STREAM
<<
"CryoCoolerCom::~CryoCoolerCom entering..."
<<
std
::
endl
;
DEBUG_STREAM
<<
"CryoCoolerCom::~CryoCoolerCom entering..."
<<
std
::
endl
;
cryo_itf
.
reset
();
//- never delete a YAT thread!
if
(
cryo_itf
)
cryo_itf
->
exit
();
cryo_itf
=
0
;
}
}
//- get the HWProxy instance ------------------------
//- get the HWProxy instance ------------------------
/*static */
CryoCoolerInterface
*
CryoCoolerCom
::
get_cryo_itf
(
void
)
yat
::
SharedPtr
<
CryoCoolerInterface
>
CryoCoolerCom
::
get_cryo_itf
(
void
)
{
{
std
::
cout
<<
"CryoCoolerCom::get_cryo_itf entering..."
<<
std
::
endl
;
std
::
cout
<<
"CryoCoolerCom::get_cryo_itf entering..."
<<
std
::
endl
;
if
(
!
cryo_itf
)
if
(
!
cryo_itf
.
get
()
)
{
{
std
::
cout
<<
"CryoCoolerCom::get_cryo_itf could not get HWProxy ..."
<<
std
::
endl
;
std
::
cout
<<
"CryoCoolerCom::get_cryo_itf could not get HWProxy ..."
<<
std
::
endl
;
THROW_DEVFAILED
(
_CPTC
(
"SOFTWARE_ERROR"
),
THROW_DEVFAILED
(
_CPTC
(
"SOFTWARE_ERROR"
),
...
@@ -310,31 +305,26 @@ namespace CryoCooler_ns
...
@@ -310,31 +305,26 @@ namespace CryoCooler_ns
void
CryoCoolerCom
::
init
(
void
)
void
CryoCoolerCom
::
init
(
void
)
{
{
DEBUG_STREAM
<<
"CryoCoolerCom::init entering..."
<<
std
::
endl
;
DEBUG_STREAM
<<
"CryoCoolerCom::init entering..."
<<
std
::
endl
;
if
(
cryo_itf
)
if
(
cryo_itf
.
get
()
)
return
;
return
;
try
try
{
{
DEBUG_STREAM
<<
"CryoCoolerCom::init trying to create HWProxy"
<<
std
::
endl
;
DEBUG_STREAM
<<
"CryoCoolerCom::init trying to create HWProxy"
<<
std
::
endl
;
cryo_itf
=
new
CryoCoolerInterface
(
this
->
devimpl
,
this
->
plc_name
,
this
->
db_read_number
,
this
->
db_write_number
,
this
->
period
,
this
->
cryocooler_protocol
);
if
(
!
cryo_itf
)
cryo_itf
.
reset
(
new
CryoCoolerInterface
(
devimpl
,
plc_name
,
db_read_number
,
db_write_number
,
period
,
cryocooler_protocol
),
yat4tango
::
DeviceTaskExiter
());
if
(
!
cryo_itf
.
get
())
{
{
ERROR_STREAM
<<
"CryoCoolerCom::init could not instanciate CryoCooler Interface ..."
<<
std
::
endl
;
ERROR_STREAM
<<
"CryoCoolerCom::init could not instanciate CryoCooler Interface ..."
<<
std
::
endl
;
throw
std
::
bad_alloc
();
throw
std
::
bad_alloc
();
}
}
//- Initialize hw proxy for DB_start, DB_end, DB_write
//- Initialize hw proxy for DB_start, DB_end, DB_write
cryo_itf
->
initialize
();
cryo_itf
.
get
()
->
initialize
();
//- go for CryoInterfaceS
//- go for CryoInterfaceS
cryo_itf
->
go
();
cryo_itf
.
get
()
->
go
();
}
}
catch
(
std
::
bad_alloc
)
catch
(
std
::
bad_alloc
)
{
{
...
@@ -356,32 +346,32 @@ namespace CryoCooler_ns
...
@@ -356,32 +346,32 @@ namespace CryoCooler_ns
unsigned
long
CryoCoolerCom
::
ComSuccess
(
void
)
unsigned
long
CryoCoolerCom
::
ComSuccess
(
void
)
{
{
//DEBUG_STREAM << "CryoCoolerCom::ComSuccess entering..." << std::endl;
//DEBUG_STREAM << "CryoCoolerCom::ComSuccess entering..." << std::endl;
return
cryo_itf
->
get_com_success
();
return
cryo_itf
.
get
()
->
get_com_success
();
}
}
unsigned
long
CryoCoolerCom
::
ComError
(
void
)
unsigned
long
CryoCoolerCom
::
ComError
(
void
)
{
{
//DEBUG_STREAM << "CryoCoolerCom::ComError entering..." << std::endl;
//DEBUG_STREAM << "CryoCoolerCom::ComError entering..." << std::endl;
return
cryo_itf
->
get_com_error
();
return
cryo_itf
.
get
()
->
get_com_error
();
}
}
HWProxy_ns
::
ComState
CryoCoolerCom
::
GetComState
(
void
)
HWProxy_ns
::
ComState
CryoCoolerCom
::
GetComState
(
void
)
{
{
//DEBUG_STREAM << "CryoCoolerCom::ComState entering..." << std::endl;
//DEBUG_STREAM << "CryoCoolerCom::ComState entering..." << std::endl;
return
cryo_itf
->
get_com_state
();
return
cryo_itf
.
get
()
->
get_com_state
();
}
}
std
::
string
CryoCoolerCom
::
GetComStatus
(
void
)
std
::
string
CryoCoolerCom
::
GetComStatus
(
void
)
{
{
//DEBUG_STREAM << "CryoCoolerCom::ComStatus entering..." << std::endl;
//DEBUG_STREAM << "CryoCoolerCom::ComStatus entering..." << std::endl;
return
(
cryo_itf
->
get_com_status
()
+
"
\n
"
+
cryo_itf
->
get_last_error
());
return
(
cryo_itf
.
get
()
->
get_com_status
()
+
"
\n
"
+
cryo_itf
.
get
()
->
get_last_error
());
}
}
//- Stop On Get ---------------------------
//- Stop On Get ---------------------------
bool
CryoCoolerCom
::
StopOn
(
void
)
bool
CryoCoolerCom
::
StopOn
(
void
)
{
{
DEBUG_STREAM
<<
"CryoCoolerCom::StopOn (read data) entering..."
<<
std
::
endl
;
DEBUG_STREAM
<<
"CryoCoolerCom::StopOn (read data) entering..."
<<
std
::
endl
;
bool
tmp
=
cryo_itf
->
get_bool
(
stop_on_bit_offset
,
stop_on_byte_offset
);
bool
tmp
=
cryo_itf
.
get
()
->
get_bool
(
stop_on_bit_offset
,
stop_on_byte_offset
);
return
tmp
;
return
tmp
;
}
}
...
@@ -434,7 +424,7 @@ namespace CryoCooler_ns
...
@@ -434,7 +424,7 @@ namespace CryoCooler_ns
bool
CryoCoolerCom
::
NoAlarm
(
void
)
bool
CryoCoolerCom
::
NoAlarm
(
void
)
{
{
//DEBUG_STREAM << "CryoCoolerCom::NoAlarm read data entering..." << std::endl;
//DEBUG_STREAM << "CryoCoolerCom::NoAlarm read data entering..." << std::endl;
bool
tmp
=
cryo_itf
->
get_bool
(
no_alarm_bit_offset
,
no_alarm_byte_offset
);
bool
tmp
=
cryo_itf
.
get
()
->
get_bool
(
no_alarm_bit_offset
,
no_alarm_byte_offset
);
return
tmp
;
return
tmp
;
}
}
...
@@ -442,7 +432,7 @@ namespace CryoCooler_ns
...
@@ -442,7 +432,7 @@ namespace CryoCooler_ns
bool
CryoCoolerCom
::
Enabled
(
void
)
bool
CryoCoolerCom
::
Enabled
(
void
)
{
{
//DEBUG_STREAM << "CryoCoolerCom::Enabled read data entering..." << std::endl;
//DEBUG_STREAM << "CryoCoolerCom::Enabled read data entering..." << std::endl;
bool
tmp
=
cryo_itf
->
get_bool
(
enabled_bit_offset
,
enabled_byte_offset
);
bool
tmp
=
cryo_itf
.
get
()
->
get_bool
(
enabled_bit_offset
,
enabled_byte_offset
);
return
tmp
;
return
tmp
;
}
}
...
@@ -450,7 +440,7 @@ namespace CryoCooler_ns
...
@@ -450,7 +440,7 @@ namespace CryoCooler_ns
bool
CryoCoolerCom
::
Ready
(
void
)
bool
CryoCoolerCom
::
Ready
(
void
)
{
{
//DEBUG_STREAM << "CryoCoolerCom::Ready read data entering..." << std::endl;
//DEBUG_STREAM << "CryoCoolerCom::Ready read data entering..." << std::endl;
bool
tmp
=
cryo_itf
->
get_bool
(
ready_bit_offset
,
ready_byte_offset
);
bool
tmp
=
cryo_itf
.
get
()
->
get_bool
(
ready_bit_offset
,
ready_byte_offset
);
return
tmp
;
return
tmp
;
}
}
...
@@ -458,7 +448,7 @@ namespace CryoCooler_ns
...
@@ -458,7 +448,7 @@ namespace CryoCooler_ns
bool
CryoCoolerCom
::
UpsNoPowerFail
(
void
)
bool
CryoCoolerCom
::
UpsNoPowerFail
(
void
)
{
{
//DEBUG_STREAM << "CryoCoolerCom::UpsNoPowerFail read data entering..." << std::endl;
//DEBUG_STREAM << "CryoCoolerCom::UpsNoPowerFail read data entering..." << std::endl;
bool
tmp
=
cryo_itf
->
get_bool
(
ups_no_fail_bit_offset
,
ups_no_fail_byte_offset
);
bool
tmp
=
cryo_itf
.
get
()
->
get_bool
(
ups_no_fail_bit_offset
,
ups_no_fail_byte_offset
);
return
tmp
;
return
tmp
;
}
}
...
@@ -466,21 +456,21 @@ namespace CryoCooler_ns
...
@@ -466,21 +456,21 @@ namespace CryoCooler_ns
bool
CryoCoolerCom
::
SensorCableConnected
(
void
)
bool
CryoCoolerCom
::
SensorCableConnected
(
void
)
{
{
//DEBUG_STREAM << "CryoCoolerCom::SensorCableConnected read data entering..." << std::endl;
//DEBUG_STREAM << "CryoCoolerCom::SensorCableConnected read data entering..." << std::endl;
bool
tmp
=
cryo_itf
->
get_bool
(
sensor_conn_bit_offset
,
sensor_conn_byte_offset
);
bool
tmp
=
cryo_itf
.
get
()
->
get_bool
(
sensor_conn_bit_offset
,
sensor_conn_byte_offset
);
return
tmp
;
return
tmp
;
}
}
//- Get VALVE CABLE CONNECTED ---------------------------------
//- Get VALVE CABLE CONNECTED ---------------------------------
bool
CryoCoolerCom
::
ValveCableConnected
(
void
)
bool
CryoCoolerCom
::
ValveCableConnected
(
void
)
{
{
//DEBUG_STREAM << "CryoCoolerCom::ValveCableConnected read data entering..." << std::endl;
//DEBUG_STREAM << "CryoCoolerCom::ValveCableConnected read data entering..." << std::endl;
bool
tmp
=
cryo_itf
->
get_bool
(
valve_conn_bit_offset
,
valve_conn_byte_offset
);
bool
tmp
=
cryo_itf
.
get
()
->
get_bool
(
valve_conn_bit_offset
,
valve_conn_byte_offset
);
return
tmp
;
return
tmp
;
}
}
//- Get HEATER CABLE CONNECTED ---------------------------------
//- Get HEATER CABLE CONNECTED ---------------------------------
bool
CryoCoolerCom
::
HeaterCableConnected
(
void
)
bool
CryoCoolerCom
::
HeaterCableConnected
(
void
)
{
{
//DEBUG_STREAM << "CryoCoolerCom::HeaterCableConnected read data entering..." << std::endl;
//DEBUG_STREAM << "CryoCoolerCom::HeaterCableConnected read data entering..." << std::endl;
bool
tmp
=
cryo_itf
->
get_bool
(
heater_conn_bit_offset
,
heater_conn_byte_offset
);
bool
tmp
=
cryo_itf
.
get
()
->
get_bool
(
heater_conn_bit_offset
,
heater_conn_byte_offset
);
return
tmp
;
return
tmp
;
}
}
...
...
This diff is collapsed.
Click to expand it.
src/cryo_support/Parts.h
+
4
−
3
View file @
5184ad94
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
//-
//-
#include
<HWProxy.h>
#include
<HWProxy.h>
#include
"CryoCoolerInterface.h"
#include
"CryoCoolerInterface.h"
#include
<yat/memory/SharedPtr.h>
namespace
CryoCooler_ns
namespace
CryoCooler_ns
...
@@ -53,7 +54,7 @@ namespace CryoCooler_ns
...
@@ -53,7 +54,7 @@ namespace CryoCooler_ns
protected
:
protected
:
//- the data "getter" class
//- the data "getter" class
CryoCoolerInterface
*
cryo_itf
;
yat
::
SharedPtr
<
CryoCoolerInterface
>
cryo_itf
;
//- status and state data;
//- status and state data;
std
::
string
com_status
;
std
::
string
com_status
;
HWProxy_ns
::
ComState
com_state
;
HWProxy_ns
::
ComState
com_state
;
...
@@ -102,10 +103,10 @@ namespace CryoCooler_ns
...
@@ -102,10 +103,10 @@ namespace CryoCooler_ns
bool
HeaterCableConnected
(
void
);
bool
HeaterCableConnected
(
void
);
//- public statis instance
//- public statis instance
static
CryoCoolerInterface
*
get_cryo_itf
();
static
yat
::
SharedPtr
<
CryoCoolerInterface
>
get_cryo_itf
();
private
:
private
:
static
CryoCoolerInterface
*
cryo_itf
;
static
yat
::
SharedPtr
<
CryoCoolerInterface
>
cryo_itf
;
size_t
period
;
size_t
period
;
Tango
::
DeviceImpl
*
devimpl
;
Tango
::
DeviceImpl
*
devimpl
;
std
::
string
plc_name
;
std
::
string
plc_name
;
...
...
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