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
9f8931dc
Commit
9f8931dc
authored
Sep 21, 2018
by
Alain BUTEAU
Browse files
Options
Downloads
Patches
Plain Diff
TANGODEVIC-1750
parent
da963c44
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
.project
+11
-0
11 additions, 0 deletions
.project
src/CryoCoolerInterface.cpp
+13
-183
13 additions, 183 deletions
src/CryoCoolerInterface.cpp
src/CryoCoolerInterface.h
+0
-11
0 additions, 11 deletions
src/CryoCoolerInterface.h
with
24 additions
and
194 deletions
.project
0 → 100644
+
11
−
0
View file @
9f8931dc
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>
CryoCooler
</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
</natures>
</projectDescription>
This diff is collapsed.
Click to expand it.
src/CryoCoolerInterface.cpp
+
13
−
183
View file @
9f8931dc
...
...
@@ -26,12 +26,8 @@ namespace CryoCooler_ns
{
DEBUG_STREAM
<<
"CryoCoolerInterface::CryoCoolerInterface <- "
<<
std
::
endl
;
#ifdef _DB_SEGMENTATION_BY_104_
hwp_rd_start
=
NULL
;
hwp_rd_end
=
NULL
;
#else
hwp
=
NULL
;
#endif
hwp_wr
=
NULL
;
//- yat::Task configure optional msg handling
...
...
@@ -52,26 +48,11 @@ namespace CryoCooler_ns
{
DEBUG_STREAM
<<
"CryoCoolerInterface::~CryoCoolerInterface <- "
<<
std
::
endl
;
#ifdef _DB_SEGMENTATION_BY_104_
if
(
hwp_rd_start
)
{
this
->
hwp_rd_start
->
exit
();
hwp_rd_start
=
NULL
;
}
if
(
hwp_rd_end
)
{
this
->
hwp_rd_end
->
exit
();
hwp_rd_end
=
NULL
;
}
#else
if
(
hwp
)
{
this
->
hwp
->
exit
();
hwp
=
NULL
;
}
#endif
if
(
hwp_wr
)
{
...
...
@@ -91,91 +72,7 @@ namespace CryoCooler_ns
DEBUG_STREAM
<<
" CryoCoolerInterface::initialize_DB try to get device proxy on "
<<
plc_name
<<
std
::
endl
;
#ifdef _DB_SEGMENTATION_BY_104_
if
(
hwp_rd_start
)
return
;
try
{
DEBUG_STREAM
<<
"CryoCoolerInterface::initialize trying to create hwp_rd_start"
<<
std
::
endl
;
HWProxy_ns
::
HWProxy
::
Config
conf
;
//- this one gets the 50 first WORDS
conf
.
url
=
plc_name
;
//- Give a specific name to plc client on the same DB number
conf
.
device_name
=
host_dev
->
get_name
()
+
"_start"
;
conf
.
db_number
=
db_read_number
;
conf
.
input_offset
=
DB_START_INPUT_OFFSET
;
conf
.
input_length
=
DB_START_INPUT_LEN
;
conf
.
output_offset
=
DB_START_OUTPUT_OFFSET
;
conf
.
output_length
=
DB_START_OUTPUT_LEN
;
// conf.periodic_timeout_ms = periodic_timeout_ms;
hwp_rd_start
=
new
HWProxy_ns
::
HWProxy
(
host_dev
,
conf
);
if
(
!
hwp_rd_start
)
{
ERROR_STREAM
<<
"CryoCoolerInterface::initialize could not instanciate hwp_rd_start ..."
<<
std
::
endl
;
throw
std
::
bad_alloc
();
}
hwp_rd_start
->
go
();
}
catch
(
std
::
bad_alloc
)
{
FATAL_STREAM
<<
"CryoCoolerInterface::initialize () catched bad_alloc"
<<
std
::
endl
;
this
->
com_state
=
HWProxy_ns
::
HWP_INITIALIZATION_ERROR
;
this
->
last_error
=
"could not instanciate hwp_rd_start class catched bad_alloc"
;
return
;
}
catch
(...)
{
FATAL_STREAM
<<
"CryoCoolerInterface::initialize () catched ..."
<<
std
::
endl
;
this
->
com_state
=
HWProxy_ns
::
HWP_INITIALIZATION_ERROR
;
this
->
last_error
=
"could not instanciate hwp_rd_start class catched (...)"
;
return
;
}
if
(
hwp_rd_end
)
return
;
try
{
DEBUG_STREAM
<<
"CryoCoolerInterface::initialize trying to create hwp_rd_end"
<<
std
::
endl
;
HWProxy_ns
::
HWProxy
::
Config
conf
;
//- this one gets the 50 last WORDS (from 100 to 200)
conf
.
url
=
plc_name
;
//- Give a specific name to plc client on the same DB number
conf
.
device_name
=
host_dev
->
get_name
()
+
"_end"
;
conf
.
db_number
=
db_read_number
;
conf
.
input_offset
=
DB_END_INPUT_OFFSET
;
conf
.
input_length
=
DB_END_INPUT_LEN
;
conf
.
output_offset
=
DB_END_OUTPUT_OFFSET
;
conf
.
output_length
=
DB_END_OUTPUT_LEN
;
// conf.periodic_timeout_ms = periodic_timeout_ms;
hwp_rd_end
=
new
HWProxy_ns
::
HWProxy
(
host_dev
,
conf
);
if
(
!
hwp_rd_end
)
{
ERROR_STREAM
<<
"CryoCoolerInterface::initialize could not instanciate hwp_rd_end ..."
<<
std
::
endl
;
throw
std
::
bad_alloc
();
}
hwp_rd_end
->
go
();
}
catch
(
std
::
bad_alloc
)
{
FATAL_STREAM
<<
"CryoCoolerInterface::initialize () catched bad_alloc"
<<
std
::
endl
;
this
->
com_state
=
HWProxy_ns
::
HWP_INITIALIZATION_ERROR
;
this
->
last_error
=
"could not instanciate hwp_rd_end class catched bad_alloc"
;
return
;
}
catch
(...)
{
FATAL_STREAM
<<
"CryoCoolerInterface::initialize () catched ..."
<<
std
::
endl
;
this
->
com_state
=
HWProxy_ns
::
HWP_INITIALIZATION_ERROR
;
this
->
last_error
=
"could not instanciate hwp_rd_end class catched (...)"
;
return
;
}
#else
if
(
hwp
)
return
;
...
...
@@ -186,7 +83,7 @@ namespace CryoCooler_ns
HWProxy_ns
::
HWProxy
::
Config
conf
;
//- this one gets the 100 last WORDS (from 0 to 200)
conf
.
url
=
plc_name
;
conf
.
device_name
=
host_dev
->
get_name
();
conf
.
device_name
=
host_dev
->
get_name
()
+
"_R"
;
conf
.
db_number
=
db_read_number
;
conf
.
input_offset
=
DB_START_INPUT_OFFSET
;
conf
.
input_length
=
(
DB_START_INPUT_LEN
+
DB_END_INPUT_LEN
);
...
...
@@ -216,7 +113,6 @@ namespace CryoCooler_ns
this
->
last_error
=
"could not instanciate hwp_rd_end class catched (...)"
;
return
;
}
#endif
if
(
hwp_wr
)
return
;
...
...
@@ -227,7 +123,7 @@ namespace CryoCooler_ns
HWProxy_ns
::
HWProxy
::
Config
conf
;
//- Write DB Data the 100 WORDS (from 0 to 100)
conf
.
url
=
plc_name
;
conf
.
device_name
=
host_dev
->
get_name
();
conf
.
device_name
=
host_dev
->
get_name
()
+
"_W"
;
conf
.
db_number
=
db_write_number
;
conf
.
input_offset
=
DB_WRITE_INPUT_OFFSET
;
conf
.
input_length
=
DB_WRITE_INPUT_LEN
;
...
...
@@ -261,20 +157,7 @@ namespace CryoCooler_ns
//------------------------------------------------------
//------------------------------------------------------
#ifdef _DB_SEGMENTATION_BY_104_
HWProxy_ns
::
HWProxy
*
CryoCoolerInterface
::
get_hw_proxy_instance
(
unsigned
int
byte_offset
)
{
//- evaluate the offset range
if
((
byte_offset
>=
DB_START_INPUT_OFFSET
)
&&
(
byte_offset
<
DB_END_INPUT_OFFSET
)
)
return
hwp_rd_start
;
else
if
((
byte_offset
>=
DB_END_INPUT_OFFSET
)
&&
(
byte_offset
<
(
DB_END_INPUT_OFFSET
+
DB_END_INPUT_LEN
)))
return
hwp_rd_end
;
else
return
NULL
;
}
#endif
//-----------------------------------------------
//- the user core of the Task -------------------
...
...
@@ -308,16 +191,9 @@ namespace CryoCooler_ns
DEBUG_STREAM
<<
"CryoCoolerInterface::process_message handling TASK_PERIODIC msg"
<<
std
::
endl
;
//- code relative to the task's periodic job goes here
#ifdef _DB_SEGMENTATION_BY_104_
this
->
com_error
=
hwp_rd_start
->
get_com_error
();
this
->
com_error
+=
hwp_rd_end
->
get_com_error
();
this
->
com_success
=
hwp_rd_start
->
get_com_success
();
this
->
com_success
+=
hwp_rd_end
->
get_com_success
();
#else
this
->
com_error
=
hwp
->
get_com_error
();
this
->
com_success
=
hwp
->
get_com_success
();
#endif
this
->
com_error
+=
hwp_wr
->
get_com_error
();
this
->
com_success
+=
hwp_wr
->
get_com_success
();
//- comm state/status
...
...
@@ -454,11 +330,8 @@ namespace CryoCooler_ns
static_cast
<
const
char
*>
(
s
.
str
().
c_str
()),
static_cast
<
const
char
*>
(
"CryoCoolerInterface::get_real"
));
}
#ifdef _DB_SEGMENTATION_BY_104_
if
(
!
(
this
->
get_hw_proxy_instance
(
byte_offset
)))
#else
if
(
!
hwp
)
#endif
{
this
->
com_state
=
HWProxy_ns
::
HWP_SOFTWARE_ERROR
;
this
->
com_status
=
"HWP_SOFTWARE_ERROR"
;
...
...
@@ -473,13 +346,8 @@ namespace CryoCooler_ns
try
{
#ifdef _DB_SEGMENTATION_BY_104_
if
(
this
->
get_hw_proxy_instance
(
byte_offset
))
fval
=
(
this
->
get_hw_proxy_instance
(
byte_offset
))
->
get_real
(
byte_offset
);
#else
if
(
hwp
)
fval
=
hwp
->
get_real
(
byte_offset
);
#endif
}
catch
(...)
{
...
...
@@ -515,11 +383,7 @@ namespace CryoCooler_ns
static_cast
<
const
char
*>
(
s
.
str
().
c_str
()),
static_cast
<
const
char
*>
(
"CryoCoolerInterface::get_int "
));
}
#ifdef _DB_SEGMENTATION_BY_104_
if
(
!
(
this
->
get_hw_proxy_instance
(
byte_offset
)))
#else
if
(
!
hwp
)
#endif
{
this
->
com_state
=
HWProxy_ns
::
HWP_SOFTWARE_ERROR
;
this
->
com_status
=
"HWP_SOFTWARE_ERROR"
;
...
...
@@ -535,13 +399,10 @@ namespace CryoCooler_ns
try
{
#ifdef _DB_SEGMENTATION_BY_104_
if
(
this
->
get_hw_proxy_instance
(
byte_offset
))
shval
=
(
this
->
get_hw_proxy_instance
(
byte_offset
))
->
get_word
(
byte_offset
);
#else
if
(
hwp
)
shval
=
hwp
->
get_word
(
byte_offset
);
#endif
}
catch
(...)
...
...
@@ -580,11 +441,9 @@ namespace CryoCooler_ns
static_cast
<
const
char
*>
(
s
.
str
().
c_str
()),
static_cast
<
const
char
*>
(
"CryoCoolerInterface::get_bool"
));
}
#ifdef _DB_SEGMENTATION_BY_104_
if
(
!
(
this
->
get_hw_proxy_instance
(
byte_offset
)))
#else
if
(
!
hwp
)
#endif
{
this
->
com_state
=
HWProxy_ns
::
HWP_SOFTWARE_ERROR
;
this
->
com_status
=
"HWP_SOFTWARE_ERROR"
;
...
...
@@ -599,12 +458,10 @@ namespace CryoCooler_ns
//- processing
try
{
#ifdef _DB_SEGMENTATION_BY_104_
bval
=
(
this
->
get_hw_proxy_instance
(
byte_offset
))
->
get_bool
(
byte_offset
,
bit_offset
);
#else
if
(
hwp
)
bval
=
hwp
->
get_bool
(
byte_offset
,
bit_offset
);
#endif
}
catch
(...)
...
...
@@ -627,32 +484,6 @@ namespace CryoCooler_ns
{
long
l_com_error
=
0
;
#ifdef _DB_SEGMENTATION_BY_104_
//- hwp_rd_start is alive
if
(
hwp_rd_start
)
{
l_com_error
+=
hwp_rd_start
->
get_com_error
();
this
->
com_state
=
hwp_rd_start
->
get_com_state
();
if
(
com_state
==
HWProxy_ns
::
HWP_COMMUNICATION_ERROR
)
{
this
->
com_status
=
hwp_rd_start
->
get_com_status
();
this
->
last_error
=
hwp_rd_start
->
get_last_error
();
return
;
}
}
//- hwp_rd_end is alive
if
(
hwp_rd_end
)
{
l_com_error
+=
hwp_rd_end
->
get_com_error
();
this
->
com_state
=
hwp_rd_end
->
get_com_state
();
if
(
com_state
==
HWProxy_ns
::
HWP_COMMUNICATION_ERROR
)
{
this
->
com_status
=
hwp_rd_end
->
get_com_status
();
this
->
last_error
=
hwp_rd_end
->
get_last_error
();
return
;
}
}
#else
if
(
hwp
)
{
l_com_error
+=
hwp
->
get_com_error
();
...
...
@@ -664,7 +495,6 @@ namespace CryoCooler_ns
return
;
}
}
#endif
//- hwp_wr is alive
if
(
hwp_wr
)
{
...
...
This diff is collapsed.
Click to expand it.
src/CryoCoolerInterface.h
+
0
−
11
View file @
9f8931dc
...
...
@@ -76,18 +76,7 @@ namespace CryoCooler_ns
short
db_write_number
;
size_t
periodic_timeout_ms
;
#ifdef _DB_SEGMENTATION_BY_104_
//- Due to the 104 words limit max, the DB is too large to get it in one plc buffer
HWProxy_ns
::
HWProxy
*
hwp_rd_start
;
HWProxy_ns
::
HWProxy
*
hwp_rd_end
;
//- get the hwp proxy associated with the specific DB_start, DB_end, DB_write
HWProxy_ns
::
HWProxy
*
get_hw_proxy_instance
(
unsigned
int
byte_offset
);
#else
HWProxy_ns
::
HWProxy
*
hwp
;
#endif
//- DB write hwp proxy
HWProxy_ns
::
HWProxy
*
hwp_wr
;
...
...
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