Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
uniset2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UniSet project repositories
uniset2
Commits
7e0f414b
Commit
7e0f414b
authored
Sep 09, 2014
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(SmemoryPlus): Решение проблеммы с "FATAL: exception not rethrown".
Заодно немного переформатировал код.
parent
46ebb465
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
512 additions
and
391 deletions
+512
-391
MBExchange.cc
extensions/ModbusMaster/MBExchange.cc
+23
-7
MBTCPMaster.cc
extensions/ModbusMaster/MBTCPMaster.cc
+46
-2
MBTCPMaster.h
extensions/ModbusMaster/MBTCPMaster.h
+1
-0
main.cc
extensions/ModbusMaster/main.cc
+4
-1
mtr-conv.cc
extensions/ModbusMaster/mtr-conv.cc
+91
-91
mtr-read.cc
extensions/ModbusMaster/mtr-read.cc
+0
-0
start_fg_mbtcp.sh
extensions/ModbusMaster/start_fg_mbtcp.sh
+1
-1
vtconv.cc
extensions/ModbusMaster/vtconv.cc
+103
-103
smemory-plus.cc
extensions/SharedMemoryPlus/smemory-plus.cc
+15
-6
Extensions.h
extensions/include/Extensions.h
+1
-1
UObject_SK.h
extensions/include/UObject_SK.h
+97
-97
LogAgregator.h
include/LogAgregator.h
+4
-4
ThreadCreator.h
include/ThreadCreator.h
+2
-3
DebugStream.cc
src/Log/DebugStream.cc
+4
-4
LogAgregator.cc
src/Log/LogAgregator.cc
+41
-40
UniSetActivator.cc
src/ObjectRepository/UniSetActivator.cc
+15
-7
UniSetManager.cc
src/ObjectRepository/UniSetManager.cc
+26
-4
UniSetObject.cc
src/ObjectRepository/UniSetObject.cc
+28
-10
IOController.cc
src/Processes/IOController.cc
+1
-1
NCRestorer.cc
src/Processes/NCRestorer.cc
+1
-1
Configuration.cc
src/Various/Configuration.cc
+8
-8
No files found.
extensions/ModbusMaster/MBExchange.cc
View file @
7e0f414b
...
@@ -165,13 +165,19 @@ MBExchange::~MBExchange()
...
@@ -165,13 +165,19 @@ MBExchange::~MBExchange()
{
{
if
(
it1
->
second
->
rtu
)
if
(
it1
->
second
->
rtu
)
{
{
delete
it1
->
second
->
rtu
;
try
{
it1
->
second
->
rtu
=
0
;
delete
it1
->
second
->
rtu
;
it1
->
second
->
rtu
=
0
;
}
catch
(...){}
}
}
RTUDevice
*
d
(
it1
->
second
);
RTUDevice
*
d
(
it1
->
second
);
for
(
auto
it
=
d
->
regmap
.
begin
();
it
!=
d
->
regmap
.
end
();
++
it
)
for
(
auto
it
=
d
->
regmap
.
begin
();
it
!=
d
->
regmap
.
end
();
++
it
)
delete
it
->
second
;
{
try
{
delete
it
->
second
;
}
catch
(...){}
}
delete
it1
->
second
;
delete
it1
->
second
;
}
}
...
@@ -193,7 +199,8 @@ void MBExchange::waitSMReady()
...
@@ -193,7 +199,8 @@ void MBExchange::waitSMReady()
ostringstream
err
;
ostringstream
err
;
err
<<
myname
<<
"(waitSMReady): failed waiting SharedMemory "
<<
ready_timeout
<<
" msec"
;
err
<<
myname
<<
"(waitSMReady): failed waiting SharedMemory "
<<
ready_timeout
<<
" msec"
;
dcrit
<<
err
.
str
()
<<
endl
;
dcrit
<<
err
.
str
()
<<
endl
;
throw
SystemError
(
err
.
str
());
if
(
checkProcActive
()
)
throw
SystemError
(
err
.
str
());
}
}
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
...
@@ -233,7 +240,15 @@ void MBExchange::sigterm( int signo )
...
@@ -233,7 +240,15 @@ void MBExchange::sigterm( int signo )
{
{
dwarn
<<
myname
<<
": ********* SIGTERM("
<<
signo
<<
") ********"
<<
endl
;
dwarn
<<
myname
<<
": ********* SIGTERM("
<<
signo
<<
") ********"
<<
endl
;
setProcActive
(
false
);
setProcActive
(
false
);
UniSetObject_LT
::
sigterm
(
signo
);
try
{
UniSetObject_LT
::
sigterm
(
signo
);
}
catch
(
...
)
{
// std::exception_ptr p = std::current_exception();
// std::clog <<(p ? p.__cxa_exception_type()->name() : "null") << std::endl;
}
}
}
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
void
MBExchange
::
readConfiguration
()
void
MBExchange
::
readConfiguration
()
...
@@ -1507,7 +1522,7 @@ void MBExchange::updateMTR( RegMap::iterator& rit )
...
@@ -1507,7 +1522,7 @@ void MBExchange::updateMTR( RegMap::iterator& rit )
if
(
r
->
mtrType
==
MTR
::
mtT4
)
if
(
r
->
mtrType
==
MTR
::
mtT4
)
{
{
if
(
save
)
if
(
save
)
{
{
dwarn
<<
myname
<<
"(updateMTR): write (T4) reg("
<<
dat2str
(
r
->
mbreg
)
<<
") to MTR NOT YET!!!"
<<
endl
;
dwarn
<<
myname
<<
"(updateMTR): write (T4) reg("
<<
dat2str
(
r
->
mbreg
)
<<
") to MTR NOT YET!!!"
<<
endl
;
}
}
else
else
...
@@ -2580,7 +2595,8 @@ void MBExchange::askSensors( UniversalIO::UIOCommand cmd )
...
@@ -2580,7 +2595,8 @@ void MBExchange::askSensors( UniversalIO::UIOCommand cmd )
dcrit
<<
err
.
str
()
<<
endl
;
dcrit
<<
err
.
str
()
<<
endl
;
kill
(
SIGTERM
,
getpid
());
// прерываем (перезапускаем) процесс...
kill
(
SIGTERM
,
getpid
());
// прерываем (перезапускаем) процесс...
throw
SystemError
(
err
.
str
());
// throw SystemError(err.str());
return
;
}
}
try
try
...
...
extensions/ModbusMaster/MBTCPMaster.cc
View file @
7e0f414b
...
@@ -75,6 +75,12 @@ pollThread(0)
...
@@ -75,6 +75,12 @@ pollThread(0)
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
MBTCPMaster
::~
MBTCPMaster
()
MBTCPMaster
::~
MBTCPMaster
()
{
{
if
(
pollThread
)
{
pollThread
->
stop
();
if
(
pollThread
->
isRunning
()
)
pollThread
->
join
();
}
delete
pollThread
;
delete
pollThread
;
//delete mbtcp;
//delete mbtcp;
}
}
...
@@ -146,12 +152,20 @@ void MBTCPMaster::poll_thread()
...
@@ -146,12 +152,20 @@ void MBTCPMaster::poll_thread()
if
(
sidExchangeMode
!=
DefaultObjectId
&&
force
)
if
(
sidExchangeMode
!=
DefaultObjectId
&&
force
)
exchangeMode
=
shm
->
localGetValue
(
itExchangeMode
,
sidExchangeMode
);
exchangeMode
=
shm
->
localGetValue
(
itExchangeMode
,
sidExchangeMode
);
}
}
catch
(...){}
catch
(...)
{
throw
;
}
try
try
{
{
poll
();
poll
();
}
}
catch
(...){}
catch
(...)
{
// if( !checkProcActive() )
throw
;
}
if
(
!
checkProcActive
()
)
if
(
!
checkProcActive
()
)
break
;
break
;
...
@@ -160,6 +174,36 @@ void MBTCPMaster::poll_thread()
...
@@ -160,6 +174,36 @@ void MBTCPMaster::poll_thread()
}
}
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
void
MBTCPMaster
::
sigterm
(
int
signo
)
{
setProcActive
(
false
);
if
(
pollThread
)
{
pollThread
->
stop
();
if
(
pollThread
->
isRunning
()
)
pollThread
->
join
();
delete
pollThread
;
pollThread
=
0
;
}
try
{
MBExchange
::
sigterm
(
signo
);
}
catch
(
const
std
::
exception
&
ex
)
{
cerr
<<
"catch: "
<<
ex
.
what
()
<<
endl
;
}
catch
(
...
)
{
std
::
exception_ptr
p
=
std
::
current_exception
();
std
::
clog
<<
(
p
?
p
.
__cxa_exception_type
()
->
name
()
:
"null"
)
<<
std
::
endl
;
}
}
// -----------------------------------------------------------------------------
void
MBTCPMaster
::
help_print
(
int
argc
,
const
char
*
const
*
argv
)
void
MBTCPMaster
::
help_print
(
int
argc
,
const
char
*
const
*
argv
)
{
{
cout
<<
"Default: prefix='mbtcp'"
<<
endl
;
cout
<<
"Default: prefix='mbtcp'"
<<
endl
;
...
...
extensions/ModbusMaster/MBTCPMaster.h
View file @
7e0f414b
...
@@ -208,6 +208,7 @@ class MBTCPMaster:
...
@@ -208,6 +208,7 @@ class MBTCPMaster:
protected
:
protected
:
virtual
void
sysCommand
(
const
UniSetTypes
::
SystemMessage
*
sm
)
override
;
virtual
void
sysCommand
(
const
UniSetTypes
::
SystemMessage
*
sm
)
override
;
virtual
std
::
shared_ptr
<
ModbusClient
>
initMB
(
bool
reopen
=
false
)
override
;
virtual
std
::
shared_ptr
<
ModbusClient
>
initMB
(
bool
reopen
=
false
)
override
;
virtual
void
sigterm
(
int
signo
)
override
;
UniSetTypes
::
uniset_rwmutex
mbMutex
;
UniSetTypes
::
uniset_rwmutex
mbMutex
;
std
::
string
iaddr
;
std
::
string
iaddr
;
...
...
extensions/ModbusMaster/main.cc
View file @
7e0f414b
...
@@ -78,9 +78,12 @@ int main( int argc, const char** argv )
...
@@ -78,9 +78,12 @@ int main( int argc, const char** argv )
}
}
catch
(...)
catch
(...)
{
{
std
::
exception_ptr
p
=
std
::
current_exception
();
std
::
clog
<<
(
p
?
p
.
__cxa_exception_type
()
->
name
()
:
"null"
)
<<
std
::
endl
;
dcrit
<<
"(mbtcpmaster): catch ..."
<<
std
::
endl
;
dcrit
<<
"(mbtcpmaster): catch ..."
<<
std
::
endl
;
}
}
on_sigchild
(
SIGTERM
);
on_sigchild
(
SIGTERM
);
return
1
;
return
1
;
}
}
extensions/ModbusMaster/mtr-conv.cc
View file @
7e0f414b
...
@@ -9,106 +9,106 @@ using namespace MTR;
...
@@ -9,106 +9,106 @@ using namespace MTR;
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
static
void
print_help
()
static
void
print_help
()
{
{
printf
(
"Usage: mtrconv TYPE[T1...T12,T16,T17] hex1 hex2
\n
"
);
printf
(
"Usage: mtrconv TYPE[T1...T12,T16,T17] hex1 hex2
\n
"
);
}
}
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
int
main
(
int
argc
,
const
char
**
argv
)
int
main
(
int
argc
,
const
char
**
argv
)
{
{
unsigned
short
v1
=
0
;
unsigned
short
v1
=
0
;
unsigned
short
v2
=
0
;
unsigned
short
v2
=
0
;
const
char
*
type
=
""
;
const
char
*
type
=
""
;
if
(
argc
<
2
)
if
(
argc
<
2
)
{
{
print_help
();
print_help
();
return
1
;
return
1
;
}
}
type
=
argv
[
1
];
type
=
argv
[
1
];
v1
=
UniSetTypes
::
uni_atoi
(
argv
[
2
]);
v1
=
UniSetTypes
::
uni_atoi
(
argv
[
2
]);
if
(
argc
>=
4
)
if
(
argc
>=
4
)
{
{
v1
=
UniSetTypes
::
uni_atoi
(
argv
[
3
]);
v1
=
UniSetTypes
::
uni_atoi
(
argv
[
3
]);
v2
=
UniSetTypes
::
uni_atoi
(
argv
[
2
]);
v2
=
UniSetTypes
::
uni_atoi
(
argv
[
2
]);
}
}
if
(
!
strcmp
(
type
,
"T1"
)
)
if
(
!
strcmp
(
type
,
"T1"
)
)
cout
<<
"(T1): v1="
<<
v1
<<
" --> (unsigned) "
<<
v1
<<
endl
;
cout
<<
"(T1): v1="
<<
v1
<<
" --> (unsigned) "
<<
v1
<<
endl
;
else
if
(
!
strcmp
(
type
,
"T2"
)
)
else
if
(
!
strcmp
(
type
,
"T2"
)
)
cout
<<
"(T2): v1="
<<
v1
<<
" --> (signed) "
<<
(
signed
short
)
v1
<<
endl
;
cout
<<
"(T2): v1="
<<
v1
<<
" --> (signed) "
<<
(
signed
short
)
v1
<<
endl
;
else
if
(
!
strcmp
(
type
,
"T16"
)
)
else
if
(
!
strcmp
(
type
,
"T16"
)
)
{
{
T16
t
(
v1
);
T16
t
(
v1
);
cout
<<
"(T16): v1="
<<
t
.
val
<<
" float="
<<
t
.
fval
<<
endl
;
cout
<<
"(T16): v1="
<<
t
.
val
<<
" float="
<<
t
.
fval
<<
endl
;
}
}
else
if
(
!
strcmp
(
type
,
"T17"
)
)
else
if
(
!
strcmp
(
type
,
"T17"
)
)
{
{
T17
t
(
v1
);
T17
t
(
v1
);
cout
<<
"(T17): v1="
<<
t
.
val
<<
" float="
<<
t
.
fval
<<
endl
;
cout
<<
"(T17): v1="
<<
t
.
val
<<
" float="
<<
t
.
fval
<<
endl
;
}
}
else
if
(
!
strcmp
(
type
,
"T3"
)
)
else
if
(
!
strcmp
(
type
,
"T3"
)
)
{
{
T3
t
(
v1
,
v2
);
T3
t
(
v1
,
v2
);
cout
<<
"(T3): v1="
<<
t
.
raw
.
v
[
0
]
<<
" v2="
<<
t
.
raw
.
v
[
1
]
cout
<<
"(T3): v1="
<<
t
.
raw
.
v
[
0
]
<<
" v2="
<<
t
.
raw
.
v
[
1
]
<<
" --> "
<<
t
<<
endl
;
<<
" --> "
<<
t
<<
endl
;
}
}
else
if
(
!
strcmp
(
type
,
"T4"
)
)
else
if
(
!
strcmp
(
type
,
"T4"
)
)
{
{
T4
t
(
v1
);
T4
t
(
v1
);
cout
<<
"(T4): v1="
<<
t
.
raw
cout
<<
"(T4): v1="
<<
t
.
raw
<<
" --> "
<<
t
<<
endl
;
<<
" --> "
<<
t
<<
endl
;
}
}
else
if
(
!
strcmp
(
type
,
"T5"
)
)
else
if
(
!
strcmp
(
type
,
"T5"
)
)
{
{
T5
t
(
v1
,
v2
);
T5
t
(
v1
,
v2
);
cout
<<
"(T5): v1="
<<
t
.
raw
.
v
[
0
]
<<
" v2="
<<
t
.
raw
.
v
[
1
]
cout
<<
"(T5): v1="
<<
t
.
raw
.
v
[
0
]
<<
" v2="
<<
t
.
raw
.
v
[
1
]
<<
" --> "
<<
t
<<
endl
;
<<
" --> "
<<
t
<<
endl
;
}
}
else
if
(
!
strcmp
(
type
,
"T6"
)
)
else
if
(
!
strcmp
(
type
,
"T6"
)
)
{
{
T6
t
(
v1
,
v2
);
T6
t
(
v1
,
v2
);
cout
<<
"(T6): v1="
<<
t
.
raw
.
v
[
0
]
<<
" v2="
<<
t
.
raw
.
v
[
1
]
cout
<<
"(T6): v1="
<<
t
.
raw
.
v
[
0
]
<<
" v2="
<<
t
.
raw
.
v
[
1
]
<<
" --> "
<<
t
<<
endl
;
<<
" --> "
<<
t
<<
endl
;
}
}
else
if
(
!
strcmp
(
type
,
"T7"
)
)
else
if
(
!
strcmp
(
type
,
"T7"
)
)
{
{
T7
t
(
v1
,
v2
);
T7
t
(
v1
,
v2
);
cout
<<
"(T7): v1="
<<
t
.
raw
.
v
[
0
]
<<
" v2="
<<
t
.
raw
.
v
[
1
]
cout
<<
"(T7): v1="
<<
t
.
raw
.
v
[
0
]
<<
" v2="
<<
t
.
raw
.
v
[
1
]
//
<< " --> " << T7.val << " * 10^-4"
//
<< " --> " << T7.val << " * 10^-4"
<<
" ===> "
<<
t
<<
endl
;
<<
" ===> "
<<
t
<<
endl
;
}
}
else
if
(
!
strcmp
(
type
,
"T8"
)
)
else
if
(
!
strcmp
(
type
,
"T8"
)
)
{
{
T8
t
(
v1
,
v2
);
T8
t
(
v1
,
v2
);
cout
<<
"(T8): v1="
<<
t
.
raw
.
v
[
0
]
<<
" v2="
<<
t
.
raw
.
v
[
1
]
cout
<<
"(T8): v1="
<<
t
.
raw
.
v
[
0
]
<<
" v2="
<<
t
.
raw
.
v
[
1
]
<<
" ===> "
<<
t
<<
endl
;
<<
" ===> "
<<
t
<<
endl
;
}
}
else
if
(
!
strcmp
(
type
,
"T9"
)
)
else
if
(
!
strcmp
(
type
,
"T9"
)
)
{
{
T9
t
(
v1
,
v2
);
T9
t
(
v1
,
v2
);
cout
<<
"(T9): v1="
<<
t
.
raw
.
v
[
0
]
<<
" v2="
<<
t
.
raw
.
v
[
1
]
cout
<<
"(T9): v1="
<<
t
.
raw
.
v
[
0
]
<<
" v2="
<<
t
.
raw
.
v
[
1
]
<<
" ===> "
<<
t
<<
endl
;
<<
" ===> "
<<
t
<<
endl
;
}
}
else
if
(
!
strcmp
(
type
,
"T10"
)
)
else
if
(
!
strcmp
(
type
,
"T10"
)
)
{
{
T10
t
(
v1
,
v2
);
T10
t
(
v1
,
v2
);
cout
<<
"(T10): v1="
<<
t
.
raw
.
v
[
0
]
<<
" v2="
<<
t
.
raw
.
v
[
1
]
cout
<<
"(T10): v1="
<<
t
.
raw
.
v
[
0
]
<<
" v2="
<<
t
.
raw
.
v
[
1
]
<<
" ===> "
<<
t
<<
endl
;
<<
" ===> "
<<
t
<<
endl
;
}
}
else
if
(
!
strcmp
(
type
,
"F1"
)
)
else
if
(
!
strcmp
(
type
,
"F1"
)
)
{
{
F1
f
(
v1
,
v2
);
F1
f
(
v1
,
v2
);
cout
<<
"(F1): v1="
<<
f
.
raw
.
v
[
0
]
<<
" v2="
<<
f
.
raw
.
v
[
1
]
cout
<<
"(F1): v1="
<<
f
.
raw
.
v
[
0
]
<<
" v2="
<<
f
.
raw
.
v
[
1
]
<<
" ===> "
<<
f
.
raw
.
val
<<
endl
;
<<
" ===> "
<<
f
.
raw
.
val
<<
endl
;
}
}
else
else
{
{
cout
<<
" Unknown type: "
<<
type
<<
endl
;
cout
<<
" Unknown type: "
<<
type
<<
endl
;
return
1
;
return
1
;
}
}
return
0
;
return
0
;
}
}
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
extensions/ModbusMaster/mtr-read.cc
View file @
7e0f414b
This diff is collapsed.
Click to expand it.
extensions/ModbusMaster/start_fg_mbtcp.sh
View file @
7e0f414b
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
--confile
test.xml
\
--confile
test.xml
\
--mbtcp-name
MBMaster1
\
--mbtcp-name
MBMaster1
\
--smemory-id
SharedMemory
\
--smemory-id
SharedMemory
\
--dlog-add-levels
info,crit,warn,level4,level3
\
--dlog-add-levels
system,
info,crit,warn,level4,level3
\
--mbtcp-set-prop-prefix
\
--mbtcp-set-prop-prefix
\
--mbtcp-filter-field
rs
\
--mbtcp-filter-field
rs
\
--mbtcp-filter-value
5
\
--mbtcp-filter-value
5
\
...
...
extensions/ModbusMaster/vtconv.cc
View file @
7e0f414b
...
@@ -9,114 +9,114 @@ using namespace VTypes;
...
@@ -9,114 +9,114 @@ using namespace VTypes;
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
static
void
print_help
()
static
void
print_help
()
{
{
printf
(
"Usage: vtconv TYPE[F2|F4|I2|U2] hex1 hex2 [hex3 hex4]
\n
"
);
printf
(
"Usage: vtconv TYPE[F2|F4|I2|U2] hex1 hex2 [hex3 hex4]
\n
"
);
}
}
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
int
main
(
int
argc
,
const
char
**
argv
)
int
main
(
int
argc
,
const
char
**
argv
)
{
{
/*
/*
VTypes::F2 f2;
VTypes::F2 f2;
f2.raw.val = 2.345;
f2.raw.val = 2.345;
cout << "Example(F2): float=" << f2.raw.val
cout << "Example(F2): float=" << f2.raw.val
<< " regs:"
<< " regs:"
<< " v[0]=" << f2.raw.v[0]
<< " v[0]=" << f2.raw.v[0]
<< " v[1]=" << f2.raw.v[1]
<< " v[1]=" << f2.raw.v[1]
<< endl;
<< endl;
VTypes::F4 f4;
VTypes::F4 f4;
f4.raw.val = 2.345123123;
f4.raw.val = 2.345123123;
cout << "Example(F4): float=" << f4.raw.val
cout << "Example(F4): float=" << f4.raw.val
<< " regs:"
<< " regs:"
<< " v[0]=" << f4.raw.v[0]
<< " v[0]=" << f4.raw.v[0]
<< " v[1]=" << f4.raw.v[1]
<< " v[1]=" << f4.raw.v[1]
<< " v[2]=" << f4.raw.v[2]
<< " v[2]=" << f4.raw.v[2]
<< " v[3]=" << f4.raw.v[3]
<< " v[3]=" << f4.raw.v[3]
<< endl;
<< endl;
cout << "-------------" << endl << endl;
cout << "-------------" << endl << endl;
VTypes::I2 i2;
VTypes::I2 i2;
i2.raw.val = -6553004;
i2.raw.val = -6553004;
cout << "Example(I2): int=" << i2.raw.val
cout << "Example(I2): int=" << i2.raw.val
<< " regs:"
<< " regs:"
<< " v[0]=" << i2.raw.v[0]
<< " v[0]=" << i2.raw.v[0]
<< " v[1]=" << i2.raw.v[1]
<< " v[1]=" << i2.raw.v[1]
<< endl;
<< endl;
cout << "-------------" << endl << endl;
cout << "-------------" << endl << endl;
VTypes::U2 u2;
VTypes::U2 u2;
u2.raw.val = 655300400;
u2.raw.val = 655300400;
cout << "Example(U2): unsigned int=" << u2.raw.val
cout << "Example(U2): unsigned int=" << u2.raw.val
<< " regs:"
<< " regs:"
<< " v[0]=" << u2.raw.v[0]
<< " v[0]=" << u2.raw.v[0]
<< " v[1]=" << u2.raw.v[1]
<< " v[1]=" << u2.raw.v[1]
<< endl;
<< endl;
cout << "-------------" << endl << endl;
cout << "-------------" << endl << endl;
//
return 0;
//
return 0;
*/
*/
unsigned
short
v
[
4
];
unsigned
short
v
[
4
];
memset
(
v
,
0
,
sizeof
(
v
));
memset
(
v
,
0
,
sizeof
(
v
));
const
char
*
type
=
""
;
const
char
*
type
=
""
;
if
(
argc
<
3
)
if
(
argc
<
3
)
{
{
print_help
();
print_help
();
return
1
;
return
1
;
}
}
type
=
argv
[
1
];
type
=
argv
[
1
];
v
[
0
]
=
UniSetTypes
::
uni_atoi
(
argv
[
2
]);
v
[
0
]
=
UniSetTypes
::
uni_atoi
(
argv
[
2
]);
if
(
argc
>
3
)
if
(
argc
>
3
)
v
[
1
]
=
UniSetTypes
::
uni_atoi
(
argv
[
3
]);
v
[
1
]
=
UniSetTypes
::
uni_atoi
(
argv
[
3
]);
if
(
argc
>
4
)
if
(
argc
>
4
)
v
[
2
]
=
UniSetTypes
::
uni_atoi
(
argv
[
4
]);
v
[
2
]
=
UniSetTypes
::
uni_atoi
(
argv
[
4
]);
if
(
argc
>
5
)
if
(
argc
>
5
)
v
[
3
]
=
UniSetTypes
::
uni_atoi
(
argv
[
5
]);
v
[
3
]
=
UniSetTypes
::
uni_atoi
(
argv
[
5
]);
if
(
!
strcmp
(
type
,
"F2"
)
)
if
(
!
strcmp
(
type
,
"F2"
)
)
{
{
VTypes
::
F2
f
(
v
,
sizeof
(
v
));
VTypes
::
F2
f
(
v
,
sizeof
(
v
));
cout
<<
"(F2): v[0]="
<<
v
[
0
]
cout
<<
"(F2): v[0]="
<<
v
[
0
]
<<
" v[1]="
<<
v
[
1
]
<<
" v[1]="
<<
v
[
1
]
<<
" --> (float) "
<<
(
float
)
f
<<
endl
;
<<
" --> (float) "
<<
(
float
)
f
<<
endl
;
}
}
else
if
(
!
strcmp
(
type
,
"F4"
)
)
else
if
(
!
strcmp
(
type
,
"F4"
)
)
{
{
VTypes
::
F4
f
(
v
,
sizeof
(
v
));
VTypes
::
F4
f
(
v
,
sizeof
(
v
));
cout
<<
"(F4): v[0]="
<<
v
[
0
]
cout
<<
"(F4): v[0]="
<<
v
[
0
]
<<
" v[1]="
<<
v
[
1
]
<<
" v[1]="
<<
v
[
1
]
<<
" v[2]="
<<
v
[
2
]
<<
" v[2]="
<<
v
[
2
]
<<
" v[3]="
<<
v
[
3
]
<<
" v[3]="
<<
v
[
3
]
<<
" --> (float) "
<<
(
float
)
f
<<
endl
;
<<
" --> (float) "
<<
(
float
)
f
<<
endl
;
}
}
else
if
(
!
strcmp
(
type
,
"I2"
)
)
else
if
(
!
strcmp
(
type
,
"I2"
)
)
{
{
VTypes
::
I2
i
(
v
,
sizeof
(
v
));
VTypes
::
I2
i
(
v
,
sizeof
(
v
));
cout
<<
"(I2): v[0]="
<<
v
[
0
]
cout
<<
"(I2): v[0]="
<<
v
[
0
]
<<
" v[1]="
<<
v
[
1
]
<<
" v[1]="
<<
v
[
1
]
<<
" --> (int) "
<<
(
int
)
i
<<
endl
;
<<
" --> (int) "
<<
(
int
)
i
<<
endl
;
}
}
else
if
(
!
strcmp
(
type
,
"U2"
)
)
else
if
(
!
strcmp
(
type
,
"U2"
)
)
{
{
VTypes
::
U2
i
(
v
,
sizeof
(
v
));
VTypes
::
U2
i
(
v
,
sizeof
(
v
));
cout
<<
"(U2): v[0]="
<<
v
[
0
]
cout
<<
"(U2): v[0]="
<<
v
[
0
]
<<
" v[1]="
<<
v
[
1
]
<<
" v[1]="
<<
v
[
1
]
<<
" --> (unsigned int) "
<<
(
unsigned
int
)
i
<<
endl
;
<<
" --> (unsigned int) "
<<
(
unsigned
int
)
i
<<
endl
;
}
}
else
else
{
{
cout
<<
" Unknown type: "
<<
type
<<
endl
;
cout
<<
" Unknown type: "
<<
type
<<
endl
;
}
}
return
0
;
return
0
;
}
}
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
extensions/SharedMemoryPlus/smemory-plus.cc
View file @
7e0f414b
...
@@ -33,16 +33,26 @@ std::list< ThreadCreator<IOControl>* > lst_iothr;
...
@@ -33,16 +33,26 @@ std::list< ThreadCreator<IOControl>* > lst_iothr;
#endif
#endif
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
void
activator_terminate
(
int
signo
)
void
activator_terminate
(
int
signo
)
{
{
if
(
logserver
)
if
(
logserver
)
{
{
delete
logserver
;
try
logserver
=
0
;
{
delete
logserver
;
logserver
=
0
;
}
catch
(...){}
}
}
#ifdef UNISET_IO_ENABLE
#ifdef UNISET_IO_ENABLE
for
(
auto
&
i
:
lst_iothr
)
for
(
auto
&
i
:
lst_iothr
)
i
->
stop
();
{
try
{
i
->
stop
();
}
catch
(...){}
}
#endif
#endif
}
}
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
...
@@ -211,14 +221,13 @@ int main( int argc, const char **argv )
...
@@ -211,14 +221,13 @@ int main( int argc, const char **argv )
la
.
add
(
ulog
);
la
.
add
(
ulog
);
la
.
add
(
dlog
);
la
.
add
(
dlog
);
#if 0
logserver
=
run_logserver
(
"smplus"
,
la
);
logserver
=
run_logserver
(
"smplus"
,
la
);
if
(
logserver
==
0
)
if
(
logserver
==
0
)
{
{
cerr
<<
"(smemory-plus): run logserver for 'smplus' FAILED"
<<
endl
;
cerr
<<
"(smemory-plus): run logserver for 'smplus' FAILED"
<<
endl
;
return
1
;
return
1
;
}
}
#endif
act
->
run
(
false
);
act
->
run
(
false
);
on_sigchild
(
SIGTERM
);
on_sigchild
(
SIGTERM
);
...
...
extensions/include/Extensions.h
View file @
7e0f414b
...
@@ -26,7 +26,7 @@ namespace UniSetExtensions
...
@@ -26,7 +26,7 @@ namespace UniSetExtensions
Calibration
*
buildCalibrationDiagram
(
const
std
::
string
&
dname
);
Calibration
*
buildCalibrationDiagram
(
const
std
::
string
&
dname
);
void
on_sigchild
(
int
sig
);
void
on_sigchild
(
int
sig
);
extern
DebugStream
dlog
;
extern
DebugStream
dlog
;
}
}
...
...
extensions/include/UObject_SK.h
View file @
7e0f414b
...
@@ -21,24 +21,24 @@
...
@@ -21,24 +21,24 @@
#include "DebugStream.h"
#include "DebugStream.h"
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
class
UObject_SK
:
class
UObject_SK
:
public
UniSetObject
,
public
UniSetObject
,
public
LT_Object
public
LT_Object
{
{
public
:
public
:
UObject_SK
(
UniSetTypes
::
ObjectId
id
,
xmlNode
*
node
=
UniSetTypes
::
conf
->
getNode
(
"UObject"
),
const
std
::
string
&
argprefix
=
""
);
UObject_SK
(
UniSetTypes
::
ObjectId
id
,
xmlNode
*
node
=
UniSetTypes
::
conf
->
getNode
(
"UObject"
),
const
std
::
string
&
argprefix
=
""
);
UObject_SK
();
UObject_SK
();
virtual
~
UObject_SK
();
virtual
~
UObject_SK
();
bool
alarm
(
UniSetTypes
::
ObjectId
sid
,
bool
state
);
bool
alarm
(
UniSetTypes
::
ObjectId
sid
,
bool
state
);
long
getValue
(
UniSetTypes
::
ObjectId
sid
);
long
getValue
(
UniSetTypes
::
ObjectId
sid
);
void
setValue
(
UniSetTypes
::
ObjectId
sid
,
long
value
);
void
setValue
(
UniSetTypes
::
ObjectId
sid
,
long
value
);
void
askSensor
(
UniSetTypes
::
ObjectId
sid
,
UniversalIO
::
UIOCommand
,
UniSetTypes
::
ObjectId
node
=
UniSetTypes
::
conf
->
getLocalNode
()
);
void
askSensor
(
UniSetTypes
::
ObjectId
sid
,
UniversalIO
::
UIOCommand
,
UniSetTypes
::
ObjectId
node
=
UniSetTypes
::
conf
->
getLocalNode
()
);
void
updateValues
();
void
updateValues
();
void
setMsg
(
UniSetTypes
::
ObjectId
code
,
bool
state
);
void
setMsg
(
UniSetTypes
::
ObjectId
code
,
bool
state
);
DebugStream
mylog
;
DebugStream
mylog
;
void
init_dlog
(
DebugStream
&
d
);
void
init_dlog
(
DebugStream
&
d
);
// "синтаксический сахар"..для логов
// "синтаксический сахар"..для логов
#define myinfo if( mylog.debugging(Debug::INFO) ) mylog
#define myinfo if( mylog.debugging(Debug::INFO) ) mylog
...
@@ -55,86 +55,86 @@ class UObject_SK:
...
@@ -55,86 +55,86 @@ class UObject_SK:
#define mylog9 if( mylog.debugging(Debug::LEVEL9) ) mylog
#define mylog9 if( mylog.debugging(Debug::LEVEL9) ) mylog
// Используемые идентификаторы
// Используемые идентификаторы
// Используемые идентификаторы сообщений
// Используемые идентификаторы сообщений
// Текущее значение и предыдущее значение
// Текущее значение и предыдущее значение
// --- public variables ---
// --- public variables ---
// --- end of public variables ---
// --- end of public variables ---
protected
:
protected
:
// --- protected variables ---
// --- protected variables ---
// ---- end of protected variables ----
// ---- end of protected variables ----
virtual
void
callback
();
virtual
void
callback
();
virtual
void
processingMessage
(
UniSetTypes
::
VoidMessage
*
msg
);
virtual
void
processingMessage
(
UniSetTypes
::
VoidMessage
*
msg
);
virtual
void
sysCommand
(
const
UniSetTypes
::
SystemMessage
*
sm
);
virtual
void
sysCommand
(
const
UniSetTypes
::
SystemMessage
*
sm
);
virtual
void
askSensors
(
UniversalIO
::
UIOCommand
cmd
){}
virtual
void
askSensors
(
UniversalIO
::
UIOCommand
cmd
){}
virtual
void
sensorInfo
(
const
UniSetTypes
::
SensorMessage
*
sm
){}
virtual
void
sensorInfo
(
const
UniSetTypes
::
SensorMessage
*
sm
){}
virtual
void
timerInfo
(
const
UniSetTypes
::
TimerMessage
*
tm
){}
virtual
void
timerInfo
(
const
UniSetTypes
::
TimerMessage
*
tm
){}
virtual
void
sigterm
(
int
signo
);
virtual
void
sigterm
(
int
signo
);
virtual
bool
activateObject
();
virtual
bool
activateObject
();
virtual
void
testMode
(
bool
state
);
virtual
void
testMode
(
bool
state
);
void
updatePreviousValues
();
void
updatePreviousValues
();
void
checkSensors
();
void
checkSensors
();
void
updateOutputs
(
bool
force
);
void
updateOutputs
(
bool
force
);
void
preAskSensors
(
UniversalIO
::
UIOCommand
cmd
);
void
preAskSensors
(
UniversalIO
::
UIOCommand
cmd
);
void
preSensorInfo
(
const
UniSetTypes
::
SensorMessage
*
sm
);
void
preSensorInfo
(
const
UniSetTypes
::
SensorMessage
*
sm
);
void
preTimerInfo
(
const
UniSetTypes
::
TimerMessage
*
tm
);
void
preTimerInfo
(
const
UniSetTypes
::
TimerMessage
*
tm
);
void
waitSM
(
int
wait_msec
,
UniSetTypes
::
ObjectId
testID
=
UniSetTypes
::
DefaultObjectId
);
void
waitSM
(
int
wait_msec
,
UniSetTypes
::
ObjectId
testID
=
UniSetTypes
::
DefaultObjectId
);
void
resetMsg
();
void
resetMsg
();
Trigger
trResetMsg
;
Trigger
trResetMsg
;
PassiveTimer
ptResetMsg
;
PassiveTimer
ptResetMsg
;
int
resetMsgTime
;
int
resetMsgTime
;
// Выполнение очередного шага программы
// Выполнение очередного шага программы
virtual
void
step
()
=
0
;
virtual
void
step
()
=
0
;
int
sleep_msec
;
/*!< пауза между итерациями */
int
sleep_msec
;
/*!< пауза между итерациями */
bool
active
;
bool
active
;
UniSetTypes
::
ObjectId
smTestID
;
/*!< идентификатор датчика для тестирования готовности SM */
UniSetTypes
::
ObjectId
smTestID
;
/*!< идентификатор датчика для тестирования готовности SM */
// управление датчиком "сердцебиения"
// управление датчиком "сердцебиения"
PassiveTimer
ptHeartBeat
;
/*! < период "сердцебиения" */
PassiveTimer
ptHeartBeat
;
/*! < период "сердцебиения" */
UniSetTypes
::
ObjectId
idHeartBeat
;
/*! < идентификатор датчика (AI) "сердцебиения" */
UniSetTypes
::
ObjectId
idHeartBeat
;
/*! < идентификатор датчика (AI) "сердцебиения" */
int
maxHeartBeat
;
/*! < сохраняемое значение */
int
maxHeartBeat
;
/*! < сохраняемое значение */
xmlNode
*
confnode
;
xmlNode
*
confnode
;
/*! получить числовое свойство из конф. файла по привязанной confnode */
/*! получить числовое свойство из конф. файла по привязанной confnode */
int
getIntProp
(
const
std
::
string
&
name
)
{
return
UniSetTypes
::
conf
->
getIntProp
(
confnode
,
name
);
}
int
getIntProp
(
const
std
::
string
&
name
)
{
return
UniSetTypes
::
conf
->
getIntProp
(
confnode
,
name
);
}
/*! получить текстовое свойство из конф. файла по привязанной confnode */
/*! получить текстовое свойство из конф. файла по привязанной confnode */
inline
const
std
::
string
getProp
(
const
std
::
string
&
name
)
{
return
UniSetTypes
::
conf
->
getProp
(
confnode
,
name
);
}
inline
const
std
::
string
getProp
(
const
std
::
string
&
name
)
{
return
UniSetTypes
::
conf
->
getProp
(
confnode
,
name
);
}
int
smReadyTimeout
;
/*!< время ожидания готовности SM */
int
smReadyTimeout
;
/*!< время ожидания готовности SM */
std
::
atomic_bool
activated
;
std
::
atomic_bool
activated
;
int
activateTimeout
;
/*!< время ожидания готовности UniSetObject к работе */
int
activateTimeout
;
/*!< время ожидания готовности UniSetObject к работе */
PassiveTimer
ptStartUpTimeout
;
/*!< время на блокировку обработки WatchDog, если недавно был StartUp */
PassiveTimer
ptStartUpTimeout
;
/*!< время на блокировку обработки WatchDog, если недавно был StartUp */
int
askPause
;
/*!< пауза между неудачными попытками заказать датчики */
int
askPause
;
/*!< пауза между неудачными попытками заказать датчики */
IOController_i
::
SensorInfo
si
;
IOController_i
::
SensorInfo
si
;
private
:
private
:
// --- private variables ---
// --- private variables ---
// --- end of private variables ---
// --- end of private variables ---
bool
end_private
;
// вспомогательное поле (для внутреннего использования при генерировании кода)
bool
end_private
;
// вспомогательное поле (для внутреннего использования при генерировании кода)
};
};
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
...
...
include/LogAgregator.h
View file @
7e0f414b
...
@@ -7,12 +7,12 @@
...
@@ -7,12 +7,12 @@
#include "LogServerTypes.h"
#include "LogServerTypes.h"
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
class
LogAgregator
:
class
LogAgregator
:
public
DebugStream
public
DebugStream
{
{
public
:
public
:
explicit
LogAgregator
(
Debug
::
type
t
=
Debug
::
NONE
);
explicit
LogAgregator
(
Debug
::
type
t
=
Debug
::
NONE
);
explicit
LogAgregator
(
char
const
*
f
,
Debug
::
type
t
=
Debug
::
NONE
);
explicit
LogAgregator
(
char
const
*
f
,
Debug
::
type
t
=
Debug
::
NONE
);
virtual
~
LogAgregator
();
virtual
~
LogAgregator
();
...
@@ -25,7 +25,7 @@ class LogAgregator:
...
@@ -25,7 +25,7 @@ class LogAgregator:
void
delLevel
(
const
std
::
string
&
logname
,
Debug
::
type
t
);
void
delLevel
(
const
std
::
string
&
logname
,
Debug
::
type
t
);
void
level
(
const
std
::
string
&
logname
,
Debug
::
type
t
);
void
level
(
const
std
::
string
&
logname
,
Debug
::
type
t
);
DebugStream
*
getLog
(
const
std
::
string
&
logname
);
DebugStream
*
getLog
(
const
std
::
string
&
logname
);
protected
:
protected
:
void
logOnEvent
(
const
std
::
string
&
s
);
void
logOnEvent
(
const
std
::
string
&
s
);
...
...
include/ThreadCreator.h
View file @
7e0f414b
...
@@ -177,9 +177,8 @@ template <class ThreadMaster>
...
@@ -177,9 +177,8 @@ template <class ThreadMaster>
void
ThreadCreator
<
ThreadMaster
>::
run
()
void
ThreadCreator
<
ThreadMaster
>::
run
()
{
{
pid
=
getpid
();
pid
=
getpid
();
if
(
m
)
if
(
m
)
(
m
->*
act
)();
(
m
->*
act
)();
// PosixThread::stop()
}
}
//----------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------
template
<
class
ThreadMaster
>
template
<
class
ThreadMaster
>
...
...
src/Log/DebugStream.cc
View file @
7e0f414b
...
@@ -50,7 +50,7 @@ DebugStream::DebugStream(Debug::type t)
...
@@ -50,7 +50,7 @@ DebugStream::DebugStream(Debug::type t)
logname
(
""
)
logname
(
""
)
{
{
delete
rdbuf
(
new
teebuf
(
cerr
.
rdbuf
(),
&
internal
->
sbuf
));
delete
rdbuf
(
new
teebuf
(
cerr
.
rdbuf
(),
&
internal
->
sbuf
));
internal
->
sbuf
.
signal_overflow
().
connect
(
sigc
::
mem_fun
(
*
this
,
&
DebugStream
::
sbuf_overflow
));
internal
->
sbuf
.
signal_overflow
().
connect
(
sigc
::
mem_fun
(
*
this
,
&
DebugStream
::
sbuf_overflow
));
}
}
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
...
@@ -67,12 +67,12 @@ DebugStream::DebugStream(char const * f, Debug::type t)
...
@@ -67,12 +67,12 @@ DebugStream::DebugStream(char const * f, Debug::type t)
delete
rdbuf
(
new
threebuf
(
cerr
.
rdbuf
(),
delete
rdbuf
(
new
threebuf
(
cerr
.
rdbuf
(),
&
internal
->
fbuf
,
&
internal
->
sbuf
));
&
internal
->
fbuf
,
&
internal
->
sbuf
));
internal
->
sbuf
.
signal_overflow
().
connect
(
sigc
::
mem_fun
(
*
this
,
&
DebugStream
::
sbuf_overflow
));
internal
->
sbuf
.
signal_overflow
().
connect
(
sigc
::
mem_fun
(
*
this
,
&
DebugStream
::
sbuf_overflow
));
}
}
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
void
DebugStream
::
sbuf_overflow
(
const
std
::
string
&
s
)
void
DebugStream
::
sbuf_overflow
(
const
std
::
string
&
s
)
{
{
s_stream
.
emit
(
s
);
s_stream
.
emit
(
s
);
}
}
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
DebugStream
::~
DebugStream
()
DebugStream
::~
DebugStream
()
...
@@ -195,7 +195,7 @@ std::ostream& DebugStream::pos(int x, int y)
...
@@ -195,7 +195,7 @@ std::ostream& DebugStream::pos(int x, int y)
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
DebugStream
::
StreamEvent_Signal
DebugStream
::
signal_stream_event
()
DebugStream
::
StreamEvent_Signal
DebugStream
::
signal_stream_event
()
{
{
return
s_stream
;
return
s_stream
;
}
}
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
...
...
src/Log/LogAgregator.cc
View file @
7e0f414b
...
@@ -2,24 +2,24 @@
...
@@ -2,24 +2,24 @@
#include "LogAgregator.h"
#include "LogAgregator.h"
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
LogAgregator
::
LogAgregator
(
char
const
*
f
,
Debug
::
type
t
)
:
LogAgregator
::
LogAgregator
(
char
const
*
f
,
Debug
::
type
t
)
:
DebugStream
(
f
,
t
)
DebugStream
(
f
,
t
)
{
{
delete
rdbuf
(
new
teebuf
(
&
internal
->
fbuf
,
&
internal
->
sbuf
));
delete
rdbuf
(
new
teebuf
(
&
internal
->
fbuf
,
&
internal
->
sbuf
));
}
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
LogAgregator
::
LogAgregator
(
Debug
::
type
t
)
:
LogAgregator
::
LogAgregator
(
Debug
::
type
t
)
:
DebugStream
(
t
)
DebugStream
(
t
)
{
{
delete
rdbuf
(
new
teebuf
(
&
internal
->
nbuf
,
&
internal
->
sbuf
));
delete
rdbuf
(
new
teebuf
(
&
internal
->
nbuf
,
&
internal
->
sbuf
));
}
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
void
LogAgregator
::
logFile
(
const
std
::
string
&
f
)
void
LogAgregator
::
logFile
(
const
std
::
string
&
f
)
{
{
DebugStream
::
logFile
(
f
);
DebugStream
::
logFile
(
f
);
if
(
f
.
empty
()
)
if
(
f
.
empty
()
)
delete
rdbuf
(
new
teebuf
(
&
internal
->
fbuf
,
&
internal
->
sbuf
));
delete
rdbuf
(
new
teebuf
(
&
internal
->
fbuf
,
&
internal
->
sbuf
));
else
else
delete
rdbuf
(
new
teebuf
(
&
internal
->
nbuf
,
&
internal
->
sbuf
));
delete
rdbuf
(
new
teebuf
(
&
internal
->
nbuf
,
&
internal
->
sbuf
));
}
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
LogAgregator
::~
LogAgregator
()
LogAgregator
::~
LogAgregator
()
...
@@ -45,51 +45,51 @@ void LogAgregator::add( DebugStream& l )
...
@@ -45,51 +45,51 @@ void LogAgregator::add( DebugStream& l )
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
void
LogAgregator
::
addLevel
(
const
std
::
string
&
logname
,
Debug
::
type
t
)
void
LogAgregator
::
addLevel
(
const
std
::
string
&
logname
,
Debug
::
type
t
)
{
{
for
(
auto
&
i
:
llst
)
for
(
auto
&
i
:
llst
)
{
{
if
(
i
->
getLogName
()
==
logname
)
if
(
i
->
getLogName
()
==
logname
)
{
{
i
->
addLevel
(
t
);
i
->
addLevel
(
t
);
break
;
break
;
}
}
}
}
}
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
void
LogAgregator
::
delLevel
(
const
std
::
string
&
logname
,
Debug
::
type
t
)
void
LogAgregator
::
delLevel
(
const
std
::
string
&
logname
,
Debug
::
type
t
)
{
{
for
(
auto
&
i
:
llst
)
for
(
auto
&
i
:
llst
)
{
{
if
(
i
->
getLogName
()
==
logname
)
if
(
i
->
getLogName
()
==
logname
)
{
{
i
->
delLevel
(
t
);
i
->
delLevel
(
t
);
break
;
break
;
}
}
}
}
}
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
void
LogAgregator
::
level
(
const
std
::
string
&
logname
,
Debug
::
type
t
)
void
LogAgregator
::
level
(
const
std
::
string
&
logname
,
Debug
::
type
t
)
{
{
for
(
auto
&
i
:
llst
)
for
(
auto
&
i
:
llst
)
{
{
if
(
i
->
getLogName
()
==
logname
)
if
(
i
->
getLogName
()
==
logname
)
{
{
i
->
level
(
t
);
i
->
level
(
t
);
break
;
break
;
}
}
}
}
}
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
DebugStream
*
LogAgregator
::
getLog
(
const
std
::
string
&
logname
)
DebugStream
*
LogAgregator
::
getLog
(
const
std
::
string
&
logname
)
{
{
if
(
logname
.
empty
()
)
if
(
logname
.
empty
()
)
return
0
;
return
0
;
for
(
auto
&
i
:
llst
)
for
(
auto
&
i
:
llst
)
{
{
if
(
i
->
getLogName
()
==
logname
)
if
(
i
->
getLogName
()
==
logname
)
return
i
;
return
i
;
}
}
return
0
;
return
0
;
}
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
\ No newline at end of file
src/ObjectRepository/UniSetActivator.cc
View file @
7e0f414b
...
@@ -191,8 +191,6 @@ void UniSetActivator::oaDestroy(int signo)
...
@@ -191,8 +191,6 @@ void UniSetActivator::oaDestroy(int signo)
try
try
{
{
stop
();
stop
();
}
}
catch
(...){}
catch
(...){}
...
@@ -210,13 +208,17 @@ void UniSetActivator::oaDestroy(int signo)
...
@@ -210,13 +208,17 @@ void UniSetActivator::oaDestroy(int signo)
ulogsys
<<
myname
<<
"(oaDestroy): orbthr="
<<
orbthr
<<
endl
;
ulogsys
<<
myname
<<
"(oaDestroy): orbthr="
<<
orbthr
<<
endl
;
if
(
orbthr
)
if
(
orbthr
)
{
{
ulogsys
<<
myname
<<
"(oaDestroy): orb thread stop... "
<<
endl
;
try
{
ulogsys
<<
myname
<<
"(oaDestroy): orb thread stop... "
<<
endl
;
orbthr
->
stop
();
orbthr
->
stop
();
if
(
orbthr
->
isRunning
()
)
if
(
orbthr
->
isRunning
()
)
orbthr
->
join
();
orbthr
->
join
();
ulogsys
<<
myname
<<
"(oaDestroy): orb thread stop ok. "
<<
endl
;
ulogsys
<<
myname
<<
"(oaDestroy): orb thread stop ok. "
<<
endl
;
}
catch
(...){}
}
}
try
try
...
@@ -520,6 +522,9 @@ void UniSetActivator::normalexit()
...
@@ -520,6 +522,9 @@ void UniSetActivator::normalexit()
{
{
if
(
gActivator
)
if
(
gActivator
)
ulogsys
<<
gActivator
->
getName
()
<<
"(default exit): good bye."
<<
endl
<<
flush
;
ulogsys
<<
gActivator
->
getName
()
<<
"(default exit): good bye."
<<
endl
<<
flush
;
// std::exception_ptr p = std::current_exception();
// std::clog <<(p ? p.__cxa_exception_type()->name() : "null") << std::endl;
}
}
void
UniSetActivator
::
normalterminate
()
void
UniSetActivator
::
normalterminate
()
...
@@ -527,6 +532,9 @@ void UniSetActivator::normalterminate()
...
@@ -527,6 +532,9 @@ void UniSetActivator::normalterminate()
if
(
gActivator
)
if
(
gActivator
)
ucrit
<<
gActivator
->
getName
()
<<
"(default exception terminate): Никто не выловил исключение!!! Good bye."
<<
endl
<<
flush
;
ucrit
<<
gActivator
->
getName
()
<<
"(default exception terminate): Никто не выловил исключение!!! Good bye."
<<
endl
<<
flush
;
// abort();
// abort();
// std::exception_ptr p = std::current_exception();
// std::clog <<(p ? p.__cxa_exception_type()->name() : "null") << std::endl;
}
}
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
void
UniSetActivator
::
term
(
int
signo
)
void
UniSetActivator
::
term
(
int
signo
)
...
...
src/ObjectRepository/UniSetManager.cc
View file @
7e0f414b
...
@@ -120,10 +120,22 @@ UniSetManager::~UniSetManager()
...
@@ -120,10 +120,22 @@ UniSetManager::~UniSetManager()
catch
(...){}
catch
(...){}
for
(
auto
&
i
:
olist
)
for
(
auto
&
i
:
olist
)
delete
i
;
{
try
{
delete
i
;
}
catch
(...){}
}
for
(
auto
&
i
:
mlist
)
for
(
auto
&
i
:
mlist
)
delete
i
;
{
try
{
delete
i
;
}
catch
(...){}
}
olist
.
clear
();
olist
.
clear
();
mlist
.
clear
();
mlist
.
clear
();
...
@@ -357,8 +369,18 @@ bool UniSetManager::deactivateObject()
...
@@ -357,8 +369,18 @@ bool UniSetManager::deactivateObject()
void
UniSetManager
::
sigterm
(
int
signo
)
void
UniSetManager
::
sigterm
(
int
signo
)
{
{
sig
=
signo
;
sig
=
signo
;
objects
(
term
);
try
managers
(
term
);
{
objects
(
term
);
}
catch
(...){}
try
{
managers
(
term
);
}
catch
(...){}
UniSetObject
::
sigterm
(
signo
);
UniSetObject
::
sigterm
(
signo
);
}
}
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
...
...
src/ObjectRepository/UniSetObject.cc
View file @
7e0f414b
...
@@ -134,16 +134,27 @@ stCountOfQueueFull(0)
...
@@ -134,16 +134,27 @@ stCountOfQueueFull(0)
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
UniSetObject
::~
UniSetObject
()
UniSetObject
::~
UniSetObject
()
{
{
deactivate
();
try
{
deactivate
();
}
catch
(...){}
tmr
->
terminate
();
try
{
tmr
->
terminate
();
}
catch
(...){}
if
(
thr
)
if
(
thr
)
{
{
thr
->
stop
();
try
{
if
(
thr
->
isRunning
()
)
thr
->
stop
();
thr
->
join
();
if
(
thr
->
isRunning
()
)
thr
->
join
();
}
catch
(...){}
delete
thr
;
delete
thr
;
}
}
...
@@ -757,8 +768,8 @@ void UniSetObject::work()
...
@@ -757,8 +768,8 @@ void UniSetObject::work()
if
(
thr
)
if
(
thr
)
msgpid
=
thr
->
getTID
();
msgpid
=
thr
->
getTID
();
while
(
isActive
()
)
while
(
isActive
()
)
callback
();
callback
();
uinfo
<<
myname
<<
": thread processing messages stopped..."
<<
endl
;
uinfo
<<
myname
<<
": thread processing messages stopped..."
<<
endl
;
}
}
...
@@ -817,10 +828,17 @@ void UniSetObject::processingMessage( UniSetTypes::VoidMessage *msg )
...
@@ -817,10 +828,17 @@ void UniSetObject::processingMessage( UniSetTypes::VoidMessage *msg )
<<
" mesg: "
<<
fe
.
errmsg
()
<<
endl
;
<<
" mesg: "
<<
fe
.
errmsg
()
<<
endl
;
}
}
}
}
catch
(...)
catch
(
const
std
::
exception
&
ex
)
{
ucrit
<<
myname
<<
"(processingMessage): "
<<
ex
.
what
()
<<
endl
;
}
/*
catch( ... )
{
{
ucrit
<<
myname
<<
"(processingMessage): catch..."
<<
endl
;
std::exception_ptr p = std::current_exception();
ucrit <<(p ? p.__cxa_exception_type()->name() : "null") << std::endl;
}
}
*/
}
}
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
...
...
src/Processes/IOController.cc
View file @
7e0f414b
...
@@ -719,7 +719,7 @@ IOController_i::ShortIOInfo IOController::getChangedTime( UniSetTypes::ObjectId
...
@@ -719,7 +719,7 @@ IOController_i::ShortIOInfo IOController::getChangedTime( UniSetTypes::ObjectId
err
<<
myname
<<
"(getChangedTime): вход(выход) с именем "
err
<<
myname
<<
"(getChangedTime): вход(выход) с именем "
<<
conf
->
oind
->
getNameById
(
sid
)
<<
" не найден"
;
<<
conf
->
oind
->
getNameById
(
sid
)
<<
" не найден"
;
uinfo
<<
err
.
str
()
<<
endl
;
uinfo
<<
err
.
str
()
<<
endl
;
throw
IOController_i
::
NameNotFound
(
err
.
str
().
c_str
());
throw
IOController_i
::
NameNotFound
(
err
.
str
().
c_str
());
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
...
...
src/Processes/NCRestorer.cc
View file @
7e0f414b
...
@@ -161,6 +161,6 @@ void NCRestorer::init_depends_signals( IONotifyController* ic )
...
@@ -161,6 +161,6 @@ void NCRestorer::init_depends_signals( IONotifyController* ic )
IOController
::
ChangeSignal
s
=
ic
->
signal_change_value
(
it
->
second
.
d_si
.
id
);
IOController
::
ChangeSignal
s
=
ic
->
signal_change_value
(
it
->
second
.
d_si
.
id
);
s
.
connect
(
sigc
::
mem_fun
(
&
it
->
second
,
&
IOController
::
USensorInfo
::
checkDepend
)
);
s
.
connect
(
sigc
::
mem_fun
(
&
it
->
second
,
&
IOController
::
USensorInfo
::
checkDepend
)
);
}
}
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
src/Various/Configuration.cc
View file @
7e0f414b
...
@@ -504,16 +504,16 @@ void Configuration::initParameters()
...
@@ -504,16 +504,16 @@ void Configuration::initParameters()
if
(
confDir
.
empty
()
)
if
(
confDir
.
empty
()
)
confDir
=
getRootDir
();
confDir
=
getRootDir
();
}
}
}
}
// Heartbeat init...
// Heartbeat init...
xmlNode
*
cnode
=
getNode
(
"HeartBeatTime"
);
xmlNode
*
cnode
=
getNode
(
"HeartBeatTime"
);
if
(
cnode
)
if
(
cnode
)
{
{
UniXML_iterator
hit
(
cnode
);
UniXML_iterator
hit
(
cnode
);
heartbeat_msec
=
hit
.
getIntProp
(
"msec"
);
heartbeat_msec
=
hit
.
getIntProp
(
"msec"
);
if
(
heartbeat_msec
<=
0
)
if
(
heartbeat_msec
<=
0
)
heartbeat_msec
=
5000
;
heartbeat_msec
=
5000
;
}
}
}
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
...
...
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