Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fug-e
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cs
ds
fug-e
Commits
40337e0a
Commit
40337e0a
authored
2 months ago
by
Lucio Zambon
Browse files
Options
Downloads
Patches
Plain Diff
current_exception
parent
df593801
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/Fug.cpp
+44
-6
44 additions, 6 deletions
src/Fug.cpp
src/Fug.h
+1
-0
1 addition, 0 deletions
src/Fug.h
with
45 additions
and
6 deletions
src/Fug.cpp
+
44
−
6
View file @
40337e0a
...
...
@@ -127,6 +127,22 @@ void Fug::delete_device() {
delete
mutex
;
}
/*
* timestamp()
* send a timestamp to standard output
*/
void
Fug
::
msg2err
(
const
char
*
msg
)
{
struct
tm
*
mytime
;
char
timeLong
[
80
];
time_t
myTime_t
;
myTime_t
=
time
(
NULL
);
mytime
=
localtime
(
&
myTime_t
);
// memset(mytime, 0, sizeof(tmTemp));
strftime
(
timeLong
,
79
,
"%Y-%m-%d %H:%M:%S "
,
mytime
);
// strftime(timeShort, 79, "%H:%M:%S ", mytime);
cerr
<<
timeLong
<<
msg
<<
endl
;
}
//+----------------------------------------------------------------------------
//
...
...
@@ -829,6 +845,11 @@ void Fug::write_Fug(string input) {
e
,
static_cast
<
const
char
*>
(
rsn
),
out_stream
.
str
(),
static_cast
<
const
char
*>
(
"SerialDeviceServer error"
),
Tango
::
ERR
);
}
catch
(...)
{
std
::
exception_ptr
p
=
std
::
current_exception
();
std
::
cerr
<<
(
p
?
p
.
__cxa_exception_type
()
->
name
()
:
"null"
)
<<
std
::
endl
;
msg2err
(
"DevSerWriteString write_Fug"
);
}
/*printf("write %s: %s\n",device_name.c_str(),input.c_str());*/
...
...
@@ -879,6 +900,11 @@ string Fug::read_Fug() {
e
,
static_cast
<
const
char
*>
(
rsn
),
out_stream
.
str
(),
static_cast
<
const
char
*>
(
"SerialDeviceServer error"
),
Tango
::
ERR
);
}
catch
(...)
{
std
::
exception_ptr
p
=
std
::
current_exception
();
std
::
cerr
<<
(
p
?
p
.
__cxa_exception_type
()
->
name
()
:
"null"
)
<<
std
::
endl
;
msg2err
(
"read_Fug DevSerWriteString"
);
}
omni_thread
::
sleep
(
0
,
sleeptime
*
1000000
);
// convert millisecond to microsecond
...
...
@@ -894,6 +920,11 @@ string Fug::read_Fug() {
e
,
static_cast
<
const
char
*>
(
rsn
),
out_stream
.
str
(),
static_cast
<
const
char
*>
(
"SerialDeviceServer error"
),
Tango
::
ERR
);
}
catch
(...)
{
std
::
exception_ptr
p
=
std
::
current_exception
();
std
::
cerr
<<
(
p
?
p
.
__cxa_exception_type
()
->
name
()
:
"null"
)
<<
std
::
endl
;
msg2err
(
"read_Fug DevSerReadRaw"
);
}
Dout
>>
strout
;
if
(
strout
.
length
()
==
0
)
{
...
...
@@ -910,13 +941,20 @@ string Fug::read_Fug() {
omni_thread
::
sleep
(
0
,
FUG_SER_SLEEP
*
1000000
);
i
=
0
;
while
(
strout
[
i
]
==
'E'
)
{
if
(
strout
[
i
+
3
]
==
'\n'
||
strout
[
i
+
3
]
==
'\r'
||
strout
[
i
+
3
]
==
'\0'
)
i
++
;
i
+=
3
;
try
{
i
=
0
;
while
(
strout
[
i
]
==
'E'
)
{
if
(
strout
[
i
+
3
]
==
'\n'
||
strout
[
i
+
3
]
==
'\r'
||
strout
[
i
+
3
]
==
'\0'
)
i
++
;
i
+=
3
;
}
strout_filt
.
resize
(
strout
.
length
()
-
i
);
strncpy
((
char
*
)
strout_filt
.
c_str
(),
(
char
*
)
strout
.
c_str
()
+
i
,
strout
.
length
()
-
i
);
}
catch
(...)
{
std
::
exception_ptr
p
=
std
::
current_exception
();
std
::
cerr
<<
(
p
?
p
.
__cxa_exception_type
()
->
name
()
:
"null"
)
<<
std
::
endl
;
msg2err
(
"read_Fug misc"
);
}
strout_filt
.
resize
(
strout
.
length
()
-
i
);
strncpy
((
char
*
)
strout_filt
.
c_str
(),
(
char
*
)
strout
.
c_str
()
+
i
,
strout
.
length
()
-
i
);
/*printf("read %s: %s\n",device_name.c_str(),strout_filt.c_str());*/
...
...
This diff is collapsed.
Click to expand it.
src/Fug.h
+
1
−
0
View file @
40337e0a
...
...
@@ -321,6 +321,7 @@ public :
friend
class
fugthread
;
private
:
void
msg2err
(
const
char
*
msg
);
Tango
::
DeviceProxy
*
devserial
;
int
abortflag
;
// flag used to abort loops (On,Off,Standby)
bool
FugStat
[
5
];
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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