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
b2cf6d77
Commit
b2cf6d77
authored
Dec 16, 2015
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move UniSetObject::askTimer to public, make style
parent
b59446ed
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
62 changed files
with
221 additions
and
128 deletions
+221
-128
admin.cc
Utilities/Admin/admin.cc
+2
-0
MBTCPServer.cc
Utilities/MBTester/MBTCPServer.cc
+1
-0
mbrtuslave.cc
Utilities/MBTester/mbrtuslave.cc
+1
-0
mbrtutester.cc
Utilities/MBTester/mbrtutester.cc
+1
-0
mbslave.cc
Utilities/MBTester/mbslave.cc
+5
-2
mbtcpserver.cc
Utilities/MBTester/mbtcpserver.cc
+4
-2
log-stdin.cc
Utilities/ULog/log-stdin.cc
+1
-0
log.cc
Utilities/ULog/log.cc
+1
-0
logserver.cc
Utilities/ULog/logserver.cc
+1
-0
TestGen.cc
Utilities/codegen/tests/TestGen.cc
+1
-0
libuniset2.spec
conf/libuniset2.spec
+4
-1
PostgreSQLInterface.h
extensions/DBServer-PostgreSQL/PostgreSQLInterface.h
+1
-1
IOControl.cc
extensions/IOControl/IOControl.cc
+1
-1
iocalibr.cc
extensions/IOControl/iocalibr.cc
+3
-0
iotest.cc
extensions/IOControl/iotest.cc
+1
-0
PassiveLProcessor.h
extensions/LogicProcessor/PassiveLProcessor.h
+1
-1
MBExchange.cc
extensions/ModbusMaster/MBExchange.cc
+24
-18
MBTCPMaster.cc
extensions/ModbusMaster/MBTCPMaster.cc
+1
-1
MBTCPMultiMaster.cc
extensions/ModbusMaster/MBTCPMultiMaster.cc
+7
-6
RTUExchange.cc
extensions/ModbusMaster/RTUExchange.cc
+4
-4
RTUStorage.cc
extensions/ModbusMaster/RTUStorage.cc
+6
-2
mtr-read.cc
extensions/ModbusMaster/mtr-read.cc
+1
-0
mtr-setup.cc
extensions/ModbusMaster/mtr-setup.cc
+1
-0
rtustate.cc
extensions/ModbusMaster/rtustate.cc
+1
-0
MBTCPTestServer.cc
extensions/ModbusMaster/tests/MBTCPTestServer.cc
+1
-0
MBSlave.cc
extensions/ModbusSlave/MBSlave.cc
+26
-14
MBSlave.h
extensions/ModbusSlave/MBSlave.h
+1
-1
RRDServer.cc
extensions/RRDServer/RRDServer.cc
+2
-1
SharedMemory.h
extensions/SharedMemory/SharedMemory.h
+16
-16
UNetExchange.cc
extensions/UNetUDP/UNetExchange.cc
+1
-0
unet-udp-tester.cc
extensions/UNetUDP/unet-udp-tester.cc
+1
-0
UniExchange.cc
extensions/UniNetwork/UniExchange.cc
+1
-1
MTR.h
extensions/include/MTR.h
+1
-1
UObject_SK.h
extensions/include/UObject_SK.h
+0
-0
IOBase.cc
extensions/lib/IOBase.cc
+6
-6
MTR.cc
extensions/lib/MTR.cc
+6
-6
UObject_SK.cc
extensions/lib/UObject_SK.cc
+0
-0
LT_Object.h
include/LT_Object.h
+1
-1
Trigger.h
include/Trigger.h
+4
-1
UniSetManager.h
include/UniSetManager.h
+1
-1
UniSetObject.h
include/UniSetObject.h
+3
-3
UModbus.cc
python/lib/pyUniSet/UModbus.cc
+1
-1
ModbusClient.cc
src/Communications/Modbus/ModbusClient.cc
+1
-1
ModbusRTUSlave.cc
src/Communications/Modbus/ModbusRTUSlave.cc
+2
-1
ModbusServer.cc
src/Communications/Modbus/ModbusServer.cc
+12
-7
ModbusTCPCore.cc
src/Communications/Modbus/ModbusTCPCore.cc
+3
-3
ModbusTCPServer.cc
src/Communications/Modbus/ModbusTCPServer.cc
+1
-0
ModbusTCPSession.cc
src/Communications/Modbus/ModbusTCPSession.cc
+3
-2
ModbusTypes.cc
src/Communications/Modbus/ModbusTypes.cc
+2
-0
UTCPStream.cc
src/Communications/TCP/UTCPStream.cc
+1
-0
LogReader.cc
src/Log/LogReader.cc
+1
-1
LogServer.cc
src/Log/LogServer.cc
+1
-0
LogSession.cc
src/Log/LogSession.cc
+5
-2
UniSetActivator.cc
src/ObjectRepository/UniSetActivator.cc
+7
-0
UniSetObject.cc
src/ObjectRepository/UniSetObject.cc
+2
-0
Configuration.cc
src/Various/Configuration.cc
+1
-0
LT_Object.cc
src/Various/LT_Object.cc
+4
-2
RunLock.cc
src/Various/RunLock.cc
+1
-0
SMonitor.cc
src/Various/SMonitor.cc
+2
-1
VMonitor.cc
src/Various/VMonitor.cc
+23
-15
WDTInterface.cc
src/Various/WDTInterface.cc
+2
-0
test_pulse.cc
tests/test_pulse.cc
+1
-1
No files found.
Utilities/Admin/admin.cc
View file @
b2cf6d77
...
@@ -225,6 +225,7 @@ int main(int argc, char** argv)
...
@@ -225,6 +225,7 @@ int main(int argc, char** argv)
ui
.
initBackId
(
UniSetTypes
::
AdminID
);
ui
.
initBackId
(
UniSetTypes
::
AdminID
);
int
userparam
=
0
;
int
userparam
=
0
;
if
(
optind
<
argc
)
if
(
optind
<
argc
)
userparam
=
uni_atoi
(
argv
[
optind
]);
userparam
=
uni_atoi
(
argv
[
optind
]);
...
@@ -538,6 +539,7 @@ static void createSections( const std::shared_ptr<UniSetTypes::Configuration>& r
...
@@ -538,6 +539,7 @@ static void createSections( const std::shared_ptr<UniSetTypes::Configuration>& r
int
omap
()
int
omap
()
{
{
std
::
ios_base
::
fmtflags
old_flags
=
cout
.
flags
();
std
::
ios_base
::
fmtflags
old_flags
=
cout
.
flags
();
try
try
{
{
cout
.
setf
(
ios
::
left
,
ios
::
adjustfield
);
cout
.
setf
(
ios
::
left
,
ios
::
adjustfield
);
...
...
Utilities/MBTester/MBTCPServer.cc
View file @
b2cf6d77
...
@@ -398,6 +398,7 @@ ModbusRTU::mbErrCode MBTCPServer::fileTransfer( ModbusRTU::FileTransferMessage&
...
@@ -398,6 +398,7 @@ ModbusRTU::mbErrCode MBTCPServer::fileTransfer( ModbusRTU::FileTransferMessage&
int seek = query.numpacket * ModbusRTU::FileTransferRetMessage::MaxDataLen;
int seek = query.numpacket * ModbusRTU::FileTransferRetMessage::MaxDataLen;
int ret = lseek(fd, seek, SEEK_SET);
int ret = lseek(fd, seek, SEEK_SET);
if( ret < 0 )
if( ret < 0 )
{
{
close(fd);
close(fd);
...
...
Utilities/MBTester/mbrtuslave.cc
View file @
b2cf6d77
...
@@ -54,6 +54,7 @@ int main( int argc, char** argv )
...
@@ -54,6 +54,7 @@ int main( int argc, char** argv )
while
(
1
)
while
(
1
)
{
{
opt
=
getopt_long
(
argc
,
argv
,
"hva:d:s:yc:"
,
longopts
,
&
optindex
);
opt
=
getopt_long
(
argc
,
argv
,
"hva:d:s:yc:"
,
longopts
,
&
optindex
);
if
(
opt
==
-
1
)
if
(
opt
==
-
1
)
break
;
break
;
...
...
Utilities/MBTester/mbrtutester.cc
View file @
b2cf6d77
...
@@ -127,6 +127,7 @@ int main( int argc, char** argv )
...
@@ -127,6 +127,7 @@ int main( int argc, char** argv )
while
(
1
)
while
(
1
)
{
{
opt
=
getopt_long
(
argc
,
argv
,
"hva:w:z:m:r:x:c:b:d:s:t:qn:u:yl:t:o:e:"
,
longopts
,
&
optindex
);
opt
=
getopt_long
(
argc
,
argv
,
"hva:w:z:m:r:x:c:b:d:s:t:qn:u:yl:t:o:e:"
,
longopts
,
&
optindex
);
if
(
opt
==
-
1
)
if
(
opt
==
-
1
)
break
;
break
;
...
...
Utilities/MBTester/mbslave.cc
View file @
b2cf6d77
...
@@ -51,8 +51,10 @@ int main( int argc, char** argv )
...
@@ -51,8 +51,10 @@ int main( int argc, char** argv )
while
(
1
)
while
(
1
)
{
{
opt
=
getopt_long
(
argc
,
argv
,
"hva:d:s:c:"
,
longopts
,
&
optindex
);
opt
=
getopt_long
(
argc
,
argv
,
"hva:d:s:c:"
,
longopts
,
&
optindex
);
if
(
opt
==
-
1
)
if
(
opt
==
-
1
)
break
;
break
;
switch
(
opt
)
switch
(
opt
)
{
{
case
'h'
:
case
'h'
:
...
@@ -90,9 +92,10 @@ int main( int argc, char** argv )
...
@@ -90,9 +92,10 @@ int main( int argc, char** argv )
}
}
}
}
auto
avec
=
UniSetTypes
::
explode_str
(
myaddr
,
','
);
auto
avec
=
UniSetTypes
::
explode_str
(
myaddr
,
','
);
std
::
unordered_set
<
ModbusRTU
::
ModbusAddr
>
vaddr
;
std
::
unordered_set
<
ModbusRTU
::
ModbusAddr
>
vaddr
;
for
(
const
auto
&
a
:
avec
)
for
(
const
auto
&
a
:
avec
)
vaddr
.
emplace
(
ModbusRTU
::
str2mbAddr
(
a
)
);
vaddr
.
emplace
(
ModbusRTU
::
str2mbAddr
(
a
)
);
if
(
verb
)
if
(
verb
)
...
...
Utilities/MBTester/mbtcpserver.cc
View file @
b2cf6d77
...
@@ -50,6 +50,7 @@ int main( int argc, char** argv )
...
@@ -50,6 +50,7 @@ int main( int argc, char** argv )
while
(
1
)
while
(
1
)
{
{
opt
=
getopt_long
(
argc
,
argv
,
"hva:p:i:bc:"
,
longopts
,
&
optindex
);
opt
=
getopt_long
(
argc
,
argv
,
"hva:p:i:bc:"
,
longopts
,
&
optindex
);
if
(
opt
!=
-
1
)
if
(
opt
!=
-
1
)
break
;
break
;
...
@@ -86,9 +87,10 @@ int main( int argc, char** argv )
...
@@ -86,9 +87,10 @@ int main( int argc, char** argv )
}
}
}
}
auto
avec
=
UniSetTypes
::
explode_str
(
myaddr
,
','
);
auto
avec
=
UniSetTypes
::
explode_str
(
myaddr
,
','
);
std
::
unordered_set
<
ModbusRTU
::
ModbusAddr
>
vaddr
;
std
::
unordered_set
<
ModbusRTU
::
ModbusAddr
>
vaddr
;
for
(
const
auto
&
a
:
avec
)
for
(
const
auto
&
a
:
avec
)
vaddr
.
emplace
(
ModbusRTU
::
str2mbAddr
(
a
)
);
vaddr
.
emplace
(
ModbusRTU
::
str2mbAddr
(
a
)
);
if
(
verb
)
if
(
verb
)
...
...
Utilities/ULog/log-stdin.cc
View file @
b2cf6d77
...
@@ -39,6 +39,7 @@ int main( int argc, char* argv[], char* envp[] )
...
@@ -39,6 +39,7 @@ int main( int argc, char* argv[], char* envp[] )
while
(
1
)
while
(
1
)
{
{
opt
=
getopt_long
(
argc
,
argv
,
"hvi:p:"
,
longopts
,
&
optindex
);
opt
=
getopt_long
(
argc
,
argv
,
"hvi:p:"
,
longopts
,
&
optindex
);
if
(
opt
==
-
1
)
if
(
opt
==
-
1
)
break
;
break
;
...
...
Utilities/ULog/log.cc
View file @
b2cf6d77
...
@@ -82,6 +82,7 @@ int main( int argc, char** argv )
...
@@ -82,6 +82,7 @@ int main( int argc, char** argv )
while
(
1
)
while
(
1
)
{
{
opt
=
getopt_long
(
argc
,
argv
,
"chvlf:a:p:i:d:s:n:eorbx:w:"
,
longopts
,
&
optindex
);
opt
=
getopt_long
(
argc
,
argv
,
"chvlf:a:p:i:d:s:n:eorbx:w:"
,
longopts
,
&
optindex
);
if
(
opt
==
-
1
)
if
(
opt
==
-
1
)
break
;
break
;
...
...
Utilities/ULog/logserver.cc
View file @
b2cf6d77
...
@@ -51,6 +51,7 @@ int main( int argc, char** argv )
...
@@ -51,6 +51,7 @@ int main( int argc, char** argv )
while
(
1
)
while
(
1
)
{
{
opt
=
getopt_long
(
argc
,
argv
,
"hvi:p:d:m:"
,
longopts
,
&
optindex
);
opt
=
getopt_long
(
argc
,
argv
,
"hvi:p:d:m:"
,
longopts
,
&
optindex
);
if
(
opt
==
-
1
)
if
(
opt
==
-
1
)
break
;
break
;
...
...
Utilities/codegen/tests/TestGen.cc
View file @
b2cf6d77
...
@@ -11,6 +11,7 @@ TestGen::TestGen( UniSetTypes::ObjectId id, xmlNode* confnode ):
...
@@ -11,6 +11,7 @@ TestGen::TestGen( UniSetTypes::ObjectId id, xmlNode* confnode ):
vmonit
(
bool_var
);
vmonit
(
bool_var
);
long
*
i
=
valptr
(
input2_s
);
long
*
i
=
valptr
(
input2_s
);
if
(
!
i
)
if
(
!
i
)
cerr
<<
"input2_s NOT FOUND!!!"
<<
endl
;
cerr
<<
"input2_s NOT FOUND!!!"
<<
endl
;
else
else
...
...
conf/libuniset2.spec
View file @
b2cf6d77
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
Name: libuniset2
Name: libuniset2
Version: 2.2
Version: 2.2
Release: alt1
2
Release: alt1
3
Summary: UniSet - library for building distributed industrial control systems
Summary: UniSet - library for building distributed industrial control systems
...
@@ -451,6 +451,9 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname
...
@@ -451,6 +451,9 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname
# ..
# ..
%changelog
%changelog
* Wed Dec 16 2015 Pavel Vainerman <pv@altlinux.ru> 2.2-alt13
- set public for UniSetObject::askTimer
* Mon Dec 14 2015 Pavel Vainerman <pv@altlinux.ru> 2.2-alt12
* Mon Dec 14 2015 Pavel Vainerman <pv@altlinux.ru> 2.2-alt12
- refactoring: remove xxx_LT classes
- refactoring: remove xxx_LT classes
- add new function for LT_Object
- add new function for LT_Object
...
...
extensions/DBServer-PostgreSQL/PostgreSQLInterface.h
View file @
b2cf6d77
...
@@ -46,7 +46,7 @@ class PostgreSQLInterface
...
@@ -46,7 +46,7 @@ class PostgreSQLInterface
class
PostgreSQLResult
class
PostgreSQLResult
{
{
public
:
public
:
PostgreSQLResult
(){}
PostgreSQLResult
()
{}
explicit
PostgreSQLResult
(
const
pqxx
::
result
&
res
);
explicit
PostgreSQLResult
(
const
pqxx
::
result
&
res
);
~
PostgreSQLResult
();
~
PostgreSQLResult
();
...
...
extensions/IOControl/IOControl.cc
View file @
b2cf6d77
...
@@ -24,7 +24,7 @@ std::ostream& operator<<( std::ostream& os, IOControl::IOInfo& inf )
...
@@ -24,7 +24,7 @@ std::ostream& operator<<( std::ostream& os, IOControl::IOInfo& inf )
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
IOControl
::
IOControl
(
UniSetTypes
::
ObjectId
id
,
UniSetTypes
::
ObjectId
icID
,
IOControl
::
IOControl
(
UniSetTypes
::
ObjectId
id
,
UniSetTypes
::
ObjectId
icID
,
const
std
::
shared_ptr
<
SharedMemory
>&
ic
,
int
numcards
,
const
std
::
string
&
prefix_
)
:
const
std
::
shared_ptr
<
SharedMemory
>&
ic
,
int
numcards
,
const
std
::
string
&
prefix_
)
:
UniSetObject
(
id
),
UniSetObject
(
id
),
polltime
(
150
),
polltime
(
150
),
cards
(
11
),
cards
(
11
),
...
...
extensions/IOControl/iocalibr.cc
View file @
b2cf6d77
...
@@ -86,6 +86,7 @@ int main(int argc, char* argv[])
...
@@ -86,6 +86,7 @@ int main(int argc, char* argv[])
while
(
1
)
while
(
1
)
{
{
opt
=
getopt_long
(
argc
,
argv
,
"hr:s:d:a:x:o:f:n:i:c:"
,
longopts
,
&
optindex
);
opt
=
getopt_long
(
argc
,
argv
,
"hr:s:d:a:x:o:f:n:i:c:"
,
longopts
,
&
optindex
);
if
(
opt
==
-
1
)
if
(
opt
==
-
1
)
break
;
break
;
...
@@ -196,6 +197,7 @@ int main(int argc, char* argv[])
...
@@ -196,6 +197,7 @@ int main(int argc, char* argv[])
cout
<<
"
\r
"
<<
"data: "
<<
setw
(
5
)
<<
data
<<
" "
<<
flush
;
cout
<<
"
\r
"
<<
"data: "
<<
setw
(
5
)
<<
data
<<
" "
<<
flush
;
ssize_t
temp
=
read
(
fd
,
&
buf
,
sizeof
(
buf
));
ssize_t
temp
=
read
(
fd
,
&
buf
,
sizeof
(
buf
));
if
(
temp
==
-
1
)
if
(
temp
==
-
1
)
{
{
close
(
fd
);
close
(
fd
);
...
@@ -347,6 +349,7 @@ void readCalibr(int fixed)
...
@@ -347,6 +349,7 @@ void readCalibr(int fixed)
close
(
f
);
close
(
f
);
return
;
return
;
}
}
if
(
temp
>
1
)
if
(
temp
>
1
)
{
{
int
s
;
int
s
;
...
...
extensions/IOControl/iotest.cc
View file @
b2cf6d77
...
@@ -71,6 +71,7 @@ int main(int argc, char* argv[])
...
@@ -71,6 +71,7 @@ int main(int argc, char* argv[])
while
(
1
)
while
(
1
)
{
{
opt
=
getopt_long
(
argc
,
argv
,
"habvr:w:i:o:s:d:c:p:m:q:x:z:"
,
longopts
,
&
optindex
);
opt
=
getopt_long
(
argc
,
argv
,
"habvr:w:i:o:s:d:c:p:m:q:x:z:"
,
longopts
,
&
optindex
);
if
(
opt
==
-
1
)
if
(
opt
==
-
1
)
break
;
break
;
...
...
extensions/LogicProcessor/PassiveLProcessor.h
View file @
b2cf6d77
...
@@ -19,7 +19,7 @@ class PassiveLProcessor:
...
@@ -19,7 +19,7 @@ class PassiveLProcessor:
public
:
public
:
PassiveLProcessor
(
UniSetTypes
::
ObjectId
objId
,
PassiveLProcessor
(
UniSetTypes
::
ObjectId
objId
,
UniSetTypes
::
ObjectId
shmID
,
const
std
::
shared_ptr
<
SharedMemory
>&
ic
=
nullptr
,
const
std
::
string
&
prefix
=
"lproc"
);
UniSetTypes
::
ObjectId
shmID
,
const
std
::
shared_ptr
<
SharedMemory
>&
ic
=
nullptr
,
const
std
::
string
&
prefix
=
"lproc"
);
virtual
~
PassiveLProcessor
();
virtual
~
PassiveLProcessor
();
enum
Timers
enum
Timers
...
...
extensions/ModbusMaster/MBExchange.cc
View file @
b2cf6d77
...
@@ -14,7 +14,7 @@ using namespace UniSetTypes;
...
@@ -14,7 +14,7 @@ using namespace UniSetTypes;
using
namespace
UniSetExtensions
;
using
namespace
UniSetExtensions
;
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
MBExchange
::
MBExchange
(
UniSetTypes
::
ObjectId
objId
,
UniSetTypes
::
ObjectId
shmId
,
MBExchange
::
MBExchange
(
UniSetTypes
::
ObjectId
objId
,
UniSetTypes
::
ObjectId
shmId
,
const
std
::
shared_ptr
<
SharedMemory
>&
_ic
,
const
std
::
string
&
prefix
)
:
const
std
::
shared_ptr
<
SharedMemory
>&
_ic
,
const
std
::
string
&
prefix
)
:
UniSetObject
(
objId
),
UniSetObject
(
objId
),
allInitOK
(
false
),
allInitOK
(
false
),
initPause
(
3000
),
initPause
(
3000
),
...
@@ -270,6 +270,7 @@ void MBExchange::waitSMReady()
...
@@ -270,6 +270,7 @@ void MBExchange::waitSMReady()
// waiting for SM is ready...
// waiting for SM is ready...
int
tout
=
uniset_conf
()
->
getArgInt
(
"--"
+
prefix
+
"-sm-ready-timeout"
,
"15000"
);
int
tout
=
uniset_conf
()
->
getArgInt
(
"--"
+
prefix
+
"-sm-ready-timeout"
,
"15000"
);
timeout_t
ready_timeout
=
15000
;
timeout_t
ready_timeout
=
15000
;
if
(
tout
>
0
)
if
(
tout
>
0
)
ready_timeout
=
tout
;
ready_timeout
=
tout
;
else
if
(
tout
<
0
)
else
if
(
tout
<
0
)
...
@@ -333,10 +334,11 @@ void MBExchange::sigterm( int signo )
...
@@ -333,10 +334,11 @@ void MBExchange::sigterm( int signo )
{
{
mbwarn
<<
myname
<<
"SIGTERM("
<<
signo
<<
"): "
<<
ex
.
what
()
<<
endl
;
mbwarn
<<
myname
<<
"SIGTERM("
<<
signo
<<
"): "
<<
ex
.
what
()
<<
endl
;
}
}
// {
// std::exception_ptr p = std::current_exception();
// {
// std::clog <<(p ? p.__cxa_exception_type()->name() : "null") << std::endl;
// std::exception_ptr p = std::current_exception();
// }
// std::clog <<(p ? p.__cxa_exception_type()->name() : "null") << std::endl;
// }
}
}
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
void
MBExchange
::
readConfiguration
()
void
MBExchange
::
readConfiguration
()
...
@@ -405,9 +407,10 @@ void MBExchange::initIterators()
...
@@ -405,9 +407,10 @@ void MBExchange::initIterators()
shm
->
initIterator
(
d
->
resp_it
);
shm
->
initIterator
(
d
->
resp_it
);
shm
->
initIterator
(
d
->
mode_it
);
shm
->
initIterator
(
d
->
mode_it
);
for
(
auto
&&
m
:
d
->
pollmap
)
for
(
auto
&&
m
:
d
->
pollmap
)
{
{
auto
&
regmap
=
m
.
second
;
auto
&
regmap
=
m
.
second
;
for
(
auto
it
=
regmap
->
begin
();
it
!=
regmap
->
end
();
++
it
)
for
(
auto
it
=
regmap
->
begin
();
it
!=
regmap
->
end
();
++
it
)
{
{
for
(
auto
it2
=
it
->
second
->
slst
.
begin
();
it2
!=
it
->
second
->
slst
.
end
();
++
it2
)
for
(
auto
it2
=
it
->
second
->
slst
.
begin
();
it2
!=
it
->
second
->
slst
.
end
();
++
it2
)
...
@@ -432,9 +435,10 @@ void MBExchange::initValues()
...
@@ -432,9 +435,10 @@ void MBExchange::initValues()
{
{
auto
d
=
it1
->
second
;
auto
d
=
it1
->
second
;
for
(
auto
&&
m
:
d
->
pollmap
)
for
(
auto
&&
m
:
d
->
pollmap
)
{
{
auto
regmap
=
m
.
second
;
auto
regmap
=
m
.
second
;
for
(
auto
it
=
regmap
->
begin
();
it
!=
regmap
->
end
();
++
it
)
for
(
auto
it
=
regmap
->
begin
();
it
!=
regmap
->
end
();
++
it
)
{
{
for
(
auto
it2
=
it
->
second
->
slst
.
begin
();
it2
!=
it
->
second
->
slst
.
end
();
++
it2
)
for
(
auto
it2
=
it
->
second
->
slst
.
begin
();
it2
!=
it
->
second
->
slst
.
end
();
++
it2
)
...
@@ -543,9 +547,9 @@ std::ostream& operator<<( std::ostream& os, MBExchange::RTUDevice& d )
...
@@ -543,9 +547,9 @@ std::ostream& operator<<( std::ostream& os, MBExchange::RTUDevice& d )
os
<<
" regs: "
<<
endl
;
os
<<
" regs: "
<<
endl
;
for
(
const
auto
&
m
:
d
.
pollmap
)
for
(
const
auto
&
m
:
d
.
pollmap
)
{
{
for
(
const
auto
&
it
:
*
(
m
.
second
)
)
for
(
const
auto
&
it
:
*
(
m
.
second
)
)
os
<<
" "
<<
it
.
second
<<
endl
;
os
<<
" "
<<
it
.
second
<<
endl
;
}
}
...
@@ -581,11 +585,11 @@ void MBExchange::rtuQueryOptimization( RTUDeviceMap& dm )
...
@@ -581,11 +585,11 @@ void MBExchange::rtuQueryOptimization( RTUDeviceMap& dm )
mbinfo
<<
myname
<<
"(rtuQueryOptimization): optimization..."
<<
endl
;
mbinfo
<<
myname
<<
"(rtuQueryOptimization): optimization..."
<<
endl
;
for
(
auto
&&
it1
:
dm
)
for
(
auto
&&
it1
:
dm
)
{
{
auto
d
=
it1
.
second
;
auto
d
=
it1
.
second
;
for
(
auto
&&
m
:
d
->
pollmap
)
for
(
auto
&&
m
:
d
->
pollmap
)
{
{
auto
&
regmap
=
m
.
second
;
auto
&
regmap
=
m
.
second
;
...
@@ -1184,7 +1188,7 @@ void MBExchange::updateSM()
...
@@ -1184,7 +1188,7 @@ void MBExchange::updateSM()
}
}
for
(
auto
&&
m
:
d
->
pollmap
)
for
(
auto
&&
m
:
d
->
pollmap
)
{
{
auto
&
regmap
=
m
.
second
;
auto
&
regmap
=
m
.
second
;
...
@@ -1242,7 +1246,7 @@ void MBExchange::updateRTU( RegMap::iterator& rit )
...
@@ -1242,7 +1246,7 @@ void MBExchange::updateRTU( RegMap::iterator& rit )
{
{
auto
&
r
=
rit
->
second
;
auto
&
r
=
rit
->
second
;
for
(
auto
&&
it
:
r
->
slst
)
for
(
auto
&&
it
:
r
->
slst
)
updateRSProperty
(
&
it
,
false
);
updateRSProperty
(
&
it
,
false
);
}
}
...
@@ -2375,10 +2379,11 @@ bool MBExchange::initItem( UniXML::iterator& it )
...
@@ -2375,10 +2379,11 @@ bool MBExchange::initItem( UniXML::iterator& it )
std
::
shared_ptr
<
RegMap
>
rmap
;
std
::
shared_ptr
<
RegMap
>
rmap
;
auto
rit
=
dev
->
pollmap
.
find
(
pollfactor
);
auto
rit
=
dev
->
pollmap
.
find
(
pollfactor
);
if
(
rit
==
dev
->
pollmap
.
end
()
)
if
(
rit
==
dev
->
pollmap
.
end
()
)
{
{
rmap
=
make_shared
<
RegMap
>
();
rmap
=
make_shared
<
RegMap
>
();
dev
->
pollmap
.
emplace
(
pollfactor
,
rmap
);
dev
->
pollmap
.
emplace
(
pollfactor
,
rmap
);
}
}
else
else
rmap
=
rit
->
second
;
rmap
=
rit
->
second
;
...
@@ -2933,9 +2938,10 @@ void MBExchange::askSensors( UniversalIO::UIOCommand cmd )
...
@@ -2933,9 +2938,10 @@ void MBExchange::askSensors( UniversalIO::UIOCommand cmd )
if
(
force_out
)
if
(
force_out
)
return
;
return
;
for
(
auto
&&
m
:
d
->
pollmap
)
for
(
auto
&&
m
:
d
->
pollmap
)
{
{
auto
&
regmap
=
m
.
second
;
auto
&
regmap
=
m
.
second
;
for
(
auto
it
=
regmap
->
begin
();
it
!=
regmap
->
end
();
++
it
)
for
(
auto
it
=
regmap
->
begin
();
it
!=
regmap
->
end
();
++
it
)
{
{
if
(
!
isWriteFunction
(
it
->
second
->
mbfunc
)
)
if
(
!
isWriteFunction
(
it
->
second
->
mbfunc
)
)
...
@@ -2984,7 +2990,7 @@ void MBExchange::sensorInfo( const UniSetTypes::SensorMessage* sm )
...
@@ -2984,7 +2990,7 @@ void MBExchange::sensorInfo( const UniSetTypes::SensorMessage* sm )
{
{
auto
&&
regmap
=
m
.
second
;
auto
&&
regmap
=
m
.
second
;
for
(
const
auto
&
it
:
(
*
regmap
)
)
for
(
const
auto
&
it
:
(
*
regmap
)
)
{
{
if
(
!
isWriteFunction
(
it
.
second
->
mbfunc
)
)
if
(
!
isWriteFunction
(
it
.
second
->
mbfunc
)
)
continue
;
continue
;
...
@@ -3062,9 +3068,9 @@ bool MBExchange::poll()
...
@@ -3062,9 +3068,9 @@ bool MBExchange::poll()
d
->
prev_numreply
.
store
(
d
->
numreply
);
d
->
prev_numreply
.
store
(
d
->
numreply
);
for
(
auto
&&
m
:
d
->
pollmap
)
for
(
auto
&&
m
:
d
->
pollmap
)
{
{
if
(
m
.
first
>
1
&&
(
ncycle
%
m
.
first
)
!=
0
)
if
(
m
.
first
>
1
&&
(
ncycle
%
m
.
first
)
!=
0
)
continue
;
continue
;
auto
&&
regmap
=
m
.
second
;
auto
&&
regmap
=
m
.
second
;
...
...
extensions/ModbusMaster/MBTCPMaster.cc
View file @
b2cf6d77
...
@@ -12,7 +12,7 @@ using namespace UniSetTypes;
...
@@ -12,7 +12,7 @@ using namespace UniSetTypes;
using
namespace
UniSetExtensions
;
using
namespace
UniSetExtensions
;
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
MBTCPMaster
::
MBTCPMaster
(
UniSetTypes
::
ObjectId
objId
,
UniSetTypes
::
ObjectId
shmId
,
MBTCPMaster
::
MBTCPMaster
(
UniSetTypes
::
ObjectId
objId
,
UniSetTypes
::
ObjectId
shmId
,
const
std
::
shared_ptr
<
SharedMemory
>&
ic
,
const
std
::
string
&
prefix
)
:
const
std
::
shared_ptr
<
SharedMemory
>&
ic
,
const
std
::
string
&
prefix
)
:
MBExchange
(
objId
,
shmId
,
ic
,
prefix
),
MBExchange
(
objId
,
shmId
,
ic
,
prefix
),
force_disconnect
(
true
)
force_disconnect
(
true
)
{
{
...
...
extensions/ModbusMaster/MBTCPMultiMaster.cc
View file @
b2cf6d77
...
@@ -451,11 +451,12 @@ void MBTCPMultiMaster::sigterm( int signo )
...
@@ -451,11 +451,12 @@ void MBTCPMultiMaster::sigterm( int signo )
{
{
mbcrit
<<
myname
<<
"(sigterm): "
<<
ex
.
what
()
<<
std
::
endl
;
mbcrit
<<
myname
<<
"(sigterm): "
<<
ex
.
what
()
<<
std
::
endl
;
}
}
// catch( ... )
// {
// catch( ... )
// std::exception_ptr p = std::current_exception();
// {
// std::clog << (p ? p.__cxa_exception_type()->name() : "null") << std::endl;
// std::exception_ptr p = std::current_exception();
// }
// std::clog << (p ? p.__cxa_exception_type()->name() : "null") << std::endl;
// }
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
...
@@ -508,7 +509,7 @@ const std::string MBTCPMultiMaster::MBSlaveInfo::getShortInfo() const
...
@@ -508,7 +509,7 @@ const std::string MBTCPMultiMaster::MBSlaveInfo::getShortInfo() const
s
<<
myname
<<
" respond="
<<
respond
s
<<
myname
<<
" respond="
<<
respond
<<
" (respond_id="
<<
respond_id
<<
" respond_invert="
<<
respond_invert
<<
" (respond_id="
<<
respond_id
<<
" respond_invert="
<<
respond_invert
<<
" recv_timeout="
<<
recv_timeout
<<
" resp_force="
<<
respond_force
<<
" recv_timeout="
<<
recv_timeout
<<
" resp_force="
<<
respond_force
<<
" use="
<<
use
<<
" ignore="
<<
ignore
<<
" priority="
<<
priority
<<
" use="
<<
use
<<
" ignore="
<<
ignore
<<
" priority="
<<
priority
<<
" persistent-connection="
<<
!
force_disconnect
<<
" persistent-connection="
<<
!
force_disconnect
<<
")"
;
<<
")"
;
...
...
extensions/ModbusMaster/RTUExchange.cc
View file @
b2cf6d77
...
@@ -10,7 +10,7 @@ using namespace UniSetTypes;
...
@@ -10,7 +10,7 @@ using namespace UniSetTypes;
using
namespace
UniSetExtensions
;
using
namespace
UniSetExtensions
;
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
RTUExchange
::
RTUExchange
(
UniSetTypes
::
ObjectId
objId
,
UniSetTypes
::
ObjectId
shmId
,
const
std
::
shared_ptr
<
SharedMemory
>&
ic
,
RTUExchange
::
RTUExchange
(
UniSetTypes
::
ObjectId
objId
,
UniSetTypes
::
ObjectId
shmId
,
const
std
::
shared_ptr
<
SharedMemory
>&
ic
,
const
std
::
string
&
prefix_
)
:
const
std
::
string
&
prefix_
)
:
MBExchange
(
objId
,
shmId
,
ic
,
prefix_
),
MBExchange
(
objId
,
shmId
,
ic
,
prefix_
),
mbrtu
(
0
),
mbrtu
(
0
),
defSpeed
(
ComPort
::
ComSpeed38400
),
defSpeed
(
ComPort
::
ComSpeed38400
),
...
@@ -251,14 +251,14 @@ bool RTUExchange::poll()
...
@@ -251,14 +251,14 @@ bool RTUExchange::poll()
dlog3
<<
myname
<<
"(poll): ask addr="
<<
ModbusRTU
::
addr2str
(
d
->
mbaddr
)
dlog3
<<
myname
<<
"(poll): ask addr="
<<
ModbusRTU
::
addr2str
(
d
->
mbaddr
)
<<
" regs="
<<
d
->
pollmap
.
size
()
<<
endl
;
<<
" regs="
<<
d
->
pollmap
.
size
()
<<
endl
;
for
(
auto
&&
m
:
d
->
pollmap
)
for
(
auto
&&
m
:
d
->
pollmap
)
{
{
if
(
m
.
first
!=
0
&&
(
ncycle
%
m
.
first
)
!=
0
)
if
(
m
.
first
!=
0
&&
(
ncycle
%
m
.
first
)
!=
0
)
continue
;
continue
;
auto
rmap
=
m
.
second
;
auto
rmap
=
m
.
second
;
for
(
auto
&&
it
=
rmap
->
begin
();
it
!=
rmap
->
end
();
++
it
)
for
(
auto
&&
it
=
rmap
->
begin
();
it
!=
rmap
->
end
();
++
it
)
{
{
try
try
{
{
...
...
extensions/ModbusMaster/RTUStorage.cc
View file @
b2cf6d77
...
@@ -132,8 +132,10 @@ void RTUStorage::poll( const std::shared_ptr<ModbusRTUMaster>& mb ) throw( Modbu
...
@@ -132,8 +132,10 @@ void RTUStorage::poll( const std::shared_ptr<ModbusRTUMaster>& mb ) throw( Modbu
for
(
unsigned
int
i
=
0
;
i
<
8
;
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
8
;
i
++
)
{
{
int
k
=
i
+
8
*
b
;
int
k
=
i
+
8
*
b
;
if
(
k
>=
48
)
if
(
k
>=
48
)
break
;
break
;
unio_do
[
k
]
=
bits
[
i
];
unio_do
[
k
]
=
bits
[
i
];
}
}
}
}
...
@@ -152,8 +154,10 @@ void RTUStorage::poll( const std::shared_ptr<ModbusRTUMaster>& mb ) throw( Modbu
...
@@ -152,8 +154,10 @@ void RTUStorage::poll( const std::shared_ptr<ModbusRTUMaster>& mb ) throw( Modbu
for
(
unsigned
int
i
=
0
;
i
<
8
;
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
8
;
i
++
)
{
{
int
k
=
i
+
8
*
b
;
int
k
=
i
+
8
*
b
;
if
(
k
>=
48
)
if
(
k
>=
48
)
break
;
break
;
unio_di
[
k
]
=
bits
[
i
];
unio_di
[
k
]
=
bits
[
i
];
}
}
}
}
...
...
extensions/ModbusMaster/mtr-read.cc
View file @
b2cf6d77
...
@@ -79,6 +79,7 @@ int main( int argc, char** argv )
...
@@ -79,6 +79,7 @@ int main( int argc, char** argv )
while
(
1
)
while
(
1
)
{
{
opt
=
getopt_long
(
argc
,
argv
,
"hvyq:r:d:s:t:x:m:n:"
,
longopts
,
&
optindex
);
opt
=
getopt_long
(
argc
,
argv
,
"hvyq:r:d:s:t:x:m:n:"
,
longopts
,
&
optindex
);
if
(
opt
==
-
1
)
if
(
opt
==
-
1
)
break
;
break
;
...
...
extensions/ModbusMaster/mtr-setup.cc
View file @
b2cf6d77
...
@@ -105,6 +105,7 @@ int main( int argc, char** argv )
...
@@ -105,6 +105,7 @@ int main( int argc, char** argv )
while
(
1
)
while
(
1
)
{
{
opt
=
getopt_long
(
argc
,
argv
,
"hvw:r:x:d:s:t:l:n:yb:e:x:z:"
,
longopts
,
&
optindex
);
opt
=
getopt_long
(
argc
,
argv
,
"hvw:r:x:d:s:t:l:n:yb:e:x:z:"
,
longopts
,
&
optindex
);
if
(
opt
==
-
1
)
if
(
opt
==
-
1
)
break
;
break
;
...
...
extensions/ModbusMaster/rtustate.cc
View file @
b2cf6d77
...
@@ -47,6 +47,7 @@ int main( int argc, char** argv )
...
@@ -47,6 +47,7 @@ int main( int argc, char** argv )
while
(
1
)
while
(
1
)
{
{
opt
=
getopt_long
(
argc
,
argv
,
"hva:d:s:t:q:"
,
longopts
,
&
optindex
);
opt
=
getopt_long
(
argc
,
argv
,
"hva:d:s:t:q:"
,
longopts
,
&
optindex
);
if
(
opt
==
-
1
)
if
(
opt
==
-
1
)
break
;
break
;
...
...
extensions/ModbusMaster/tests/MBTCPTestServer.cc
View file @
b2cf6d77
...
@@ -483,6 +483,7 @@ ModbusRTU::mbErrCode MBTCPTestServer::fileTransfer( ModbusRTU::FileTransferMessa
...
@@ -483,6 +483,7 @@ ModbusRTU::mbErrCode MBTCPTestServer::fileTransfer( ModbusRTU::FileTransferMessa
int seek = query.numpacket * ModbusRTU::FileTransferRetMessage::MaxDataLen;
int seek = query.numpacket * ModbusRTU::FileTransferRetMessage::MaxDataLen;
int ret = lseek(fd, seek, SEEK_SET);
int ret = lseek(fd, seek, SEEK_SET);
if( ret < 0 )
if( ret < 0 )
{
{
close(fd);
close(fd);
...
...
extensions/ModbusSlave/MBSlave.cc
View file @
b2cf6d77
...
@@ -217,7 +217,7 @@ MBSlave::MBSlave(UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmId, const
...
@@ -217,7 +217,7 @@ MBSlave::MBSlave(UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmId, const
{
{
readConfiguration
();
readConfiguration
();
mbinfo
<<
myname
<<
"(init): iomap size = "
<<
iomap
.
size
()
mbinfo
<<
myname
<<
"(init): iomap size = "
<<
iomap
.
size
()
<<
" myaddr="
<<
ModbusServer
::
vaddr2str
(
vaddr
)
<<
endl
;
<<
" myaddr="
<<
ModbusServer
::
vaddr2str
(
vaddr
)
<<
endl
;
}
}
else
else
{
{
...
@@ -463,6 +463,7 @@ void MBSlave::waitSMReady()
...
@@ -463,6 +463,7 @@ void MBSlave::waitSMReady()
// waiting for SM is ready...
// waiting for SM is ready...
int
tout
=
uniset_conf
()
->
getArgInt
(
"--"
+
prefix
+
"-sm-ready-timeout"
,
"15000"
);
int
tout
=
uniset_conf
()
->
getArgInt
(
"--"
+
prefix
+
"-sm-ready-timeout"
,
"15000"
);
timeout_t
ready_timeout
=
15000
;
timeout_t
ready_timeout
=
15000
;
if
(
tout
>
0
)
if
(
tout
>
0
)
ready_timeout
=
tout
;
ready_timeout
=
tout
;
else
if
(
tout
<
0
)
else
if
(
tout
<
0
)
...
@@ -491,6 +492,7 @@ void MBSlave::execute_rtu()
...
@@ -491,6 +492,7 @@ void MBSlave::execute_rtu()
if
(
!
shm
->
isLocalwork
()
)
if
(
!
shm
->
isLocalwork
()
)
{
{
std
::
unique_lock
<
std
::
mutex
>
locker
(
mutexStartNotify
);
std
::
unique_lock
<
std
::
mutex
>
locker
(
mutexStartNotify
);
while
(
!
activated
)
while
(
!
activated
)
startNotifyEvent
.
wait
(
locker
);
startNotifyEvent
.
wait
(
locker
);
}
}
...
@@ -503,8 +505,8 @@ void MBSlave::execute_rtu()
...
@@ -503,8 +505,8 @@ void MBSlave::execute_rtu()
}
}
mbinfo
<<
myname
<<
"(execute_rtu): thread running.."
mbinfo
<<
myname
<<
"(execute_rtu): thread running.."
<<
" iomap size = "
<<
iomap
.
size
()
<<
" iomap size = "
<<
iomap
.
size
()
<<
" myaddr="
<<
ModbusServer
::
vaddr2str
(
vaddr
)
<<
" myaddr="
<<
ModbusServer
::
vaddr2str
(
vaddr
)
<<
endl
;
<<
endl
;
while
(
!
cancelled
)
while
(
!
cancelled
)
...
@@ -577,9 +579,9 @@ void MBSlave::execute_rtu()
...
@@ -577,9 +579,9 @@ void MBSlave::execute_rtu()
}
}
}
}
for
(
auto
&&
rmap
:
iomap
)
for
(
auto
&&
rmap
:
iomap
)
{
{
for
(
auto
&&
it
:
rmap
.
second
)
for
(
auto
&&
it
:
rmap
.
second
)
IOBase
::
processingThreshold
(
&
it
.
second
,
shm
,
force
);
IOBase
::
processingThreshold
(
&
it
.
second
,
shm
,
force
);
}
}
}
}
...
@@ -598,6 +600,7 @@ void MBSlave::execute_tcp()
...
@@ -598,6 +600,7 @@ void MBSlave::execute_tcp()
if
(
!
shm
->
isLocalwork
()
)
if
(
!
shm
->
isLocalwork
()
)
{
{
std
::
unique_lock
<
std
::
mutex
>
locker
(
mutexStartNotify
);
std
::
unique_lock
<
std
::
mutex
>
locker
(
mutexStartNotify
);
while
(
!
activated
)
while
(
!
activated
)
startNotifyEvent
.
wait
(
locker
);
startNotifyEvent
.
wait
(
locker
);
}
}
...
@@ -610,8 +613,8 @@ void MBSlave::execute_tcp()
...
@@ -610,8 +613,8 @@ void MBSlave::execute_tcp()
}
}
mbinfo
<<
myname
<<
"(execute_tcp): thread running.."
mbinfo
<<
myname
<<
"(execute_tcp): thread running.."
<<
" iomap size = "
<<
iomap
.
size
()
<<
" iomap size = "
<<
iomap
.
size
()
<<
" myaddr="
<<
ModbusServer
::
vaddr2str
(
vaddr
)
<<
" myaddr="
<<
ModbusServer
::
vaddr2str
(
vaddr
)
<<
endl
;
<<
endl
;
while
(
!
cancelled
)
while
(
!
cancelled
)
...
@@ -685,9 +688,9 @@ void MBSlave::execute_tcp()
...
@@ -685,9 +688,9 @@ void MBSlave::execute_tcp()
}
}
}
}
for
(
auto
&&
rmap
:
iomap
)
for
(
auto
&&
rmap
:
iomap
)
{
{
for
(
auto
&&
it
:
rmap
.
second
)
for
(
auto
&&
it
:
rmap
.
second
)
IOBase
::
processingThreshold
(
&
it
.
second
,
shm
,
force
);
IOBase
::
processingThreshold
(
&
it
.
second
,
shm
,
force
);
}
}
}
}
...
@@ -802,7 +805,7 @@ void MBSlave::askSensors( UniversalIO::UIOCommand cmd )
...
@@ -802,7 +805,7 @@ void MBSlave::askSensors( UniversalIO::UIOCommand cmd )
if
(
force
)
if
(
force
)
return
;
return
;
for
(
const
auto
&
rmap
:
iomap
)
for
(
const
auto
&
rmap
:
iomap
)
{
{
for
(
const
auto
&
it
:
rmap
.
second
)
for
(
const
auto
&
it
:
rmap
.
second
)
{
{
...
@@ -823,10 +826,11 @@ void MBSlave::askSensors( UniversalIO::UIOCommand cmd )
...
@@ -823,10 +826,11 @@ void MBSlave::askSensors( UniversalIO::UIOCommand cmd )
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
void
MBSlave
::
sensorInfo
(
const
UniSetTypes
::
SensorMessage
*
sm
)
void
MBSlave
::
sensorInfo
(
const
UniSetTypes
::
SensorMessage
*
sm
)
{
{
for
(
auto
&&
regs
:
iomap
)
for
(
auto
&&
regs
:
iomap
)
{
{
auto
&
rmap
=
regs
.
second
;
auto
&
rmap
=
regs
.
second
;
for
(
auto
it
=
rmap
.
begin
();
it
!=
rmap
.
end
();
++
it
)
for
(
auto
it
=
rmap
.
begin
();
it
!=
rmap
.
end
();
++
it
)
{
{
if
(
it
->
second
.
si
.
id
==
sm
->
id
)
if
(
it
->
second
.
si
.
id
==
sm
->
id
)
{
{
...
@@ -1229,7 +1233,7 @@ bool MBSlave::BitRegProperty::check( const IOController_i::SensorInfo& si )
...
@@ -1229,7 +1233,7 @@ bool MBSlave::BitRegProperty::check( const IOController_i::SensorInfo& si )
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
void
MBSlave
::
initIterators
()
void
MBSlave
::
initIterators
()
{
{
for
(
auto
&&
regs
:
iomap
)
for
(
auto
&&
regs
:
iomap
)
{
{
auto
&
rmap
=
regs
.
second
;
auto
&
rmap
=
regs
.
second
;
...
@@ -1377,6 +1381,7 @@ ModbusRTU::mbErrCode MBSlave::readOutputRegisters( ModbusRTU::ReadOutputMessage&
...
@@ -1377,6 +1381,7 @@ ModbusRTU::mbErrCode MBSlave::readOutputRegisters( ModbusRTU::ReadOutputMessage&
mbinfo
<<
myname
<<
"(readOutputRegisters): "
<<
query
<<
endl
;
mbinfo
<<
myname
<<
"(readOutputRegisters): "
<<
query
<<
endl
;
auto
regmap
=
iomap
.
find
(
query
.
addr
);
auto
regmap
=
iomap
.
find
(
query
.
addr
);
if
(
regmap
==
iomap
.
end
()
)
if
(
regmap
==
iomap
.
end
()
)
{
{
mbinfo
<<
myname
<<
"(readOutputRegisters): Unknown addr="
<<
ModbusRTU
::
addr2str
(
query
.
addr
)
<<
endl
;
mbinfo
<<
myname
<<
"(readOutputRegisters): Unknown addr="
<<
ModbusRTU
::
addr2str
(
query
.
addr
)
<<
endl
;
...
@@ -1415,6 +1420,7 @@ ModbusRTU::mbErrCode MBSlave::writeOutputRegisters( ModbusRTU::WriteOutputMessag
...
@@ -1415,6 +1420,7 @@ ModbusRTU::mbErrCode MBSlave::writeOutputRegisters( ModbusRTU::WriteOutputMessag
mbinfo
<<
myname
<<
"(writeOutputRegisters): "
<<
query
<<
endl
;
mbinfo
<<
myname
<<
"(writeOutputRegisters): "
<<
query
<<
endl
;
auto
regmap
=
iomap
.
find
(
query
.
addr
);
auto
regmap
=
iomap
.
find
(
query
.
addr
);
if
(
regmap
==
iomap
.
end
()
)
if
(
regmap
==
iomap
.
end
()
)
{
{
mbinfo
<<
myname
<<
"(writeOutputRegisters): Unknown addr="
<<
ModbusRTU
::
addr2str
(
query
.
addr
)
<<
endl
;
mbinfo
<<
myname
<<
"(writeOutputRegisters): Unknown addr="
<<
ModbusRTU
::
addr2str
(
query
.
addr
)
<<
endl
;
...
@@ -1437,6 +1443,7 @@ ModbusRTU::mbErrCode MBSlave::writeOutputSingleRegister( ModbusRTU::WriteSingleO
...
@@ -1437,6 +1443,7 @@ ModbusRTU::mbErrCode MBSlave::writeOutputSingleRegister( ModbusRTU::WriteSingleO
mbinfo
<<
myname
<<
"(writeOutputSingleRegisters): "
<<
query
<<
endl
;
mbinfo
<<
myname
<<
"(writeOutputSingleRegisters): "
<<
query
<<
endl
;
auto
regmap
=
iomap
.
find
(
query
.
addr
);
auto
regmap
=
iomap
.
find
(
query
.
addr
);
if
(
regmap
==
iomap
.
end
()
)
if
(
regmap
==
iomap
.
end
()
)
{
{
mbinfo
<<
myname
<<
"(writeOutputRegisters): Unknown addr="
<<
ModbusRTU
::
addr2str
(
query
.
addr
)
<<
endl
;
mbinfo
<<
myname
<<
"(writeOutputRegisters): Unknown addr="
<<
ModbusRTU
::
addr2str
(
query
.
addr
)
<<
endl
;
...
@@ -2046,6 +2053,7 @@ mbErrCode MBSlave::readInputRegisters( ReadInputMessage& query, ReadInputRetMess
...
@@ -2046,6 +2053,7 @@ mbErrCode MBSlave::readInputRegisters( ReadInputMessage& query, ReadInputRetMess
mbinfo
<<
myname
<<
"(readInputRegisters): "
<<
query
<<
endl
;
mbinfo
<<
myname
<<
"(readInputRegisters): "
<<
query
<<
endl
;
auto
regmap
=
iomap
.
find
(
query
.
addr
);
auto
regmap
=
iomap
.
find
(
query
.
addr
);
if
(
regmap
==
iomap
.
end
()
)
if
(
regmap
==
iomap
.
end
()
)
{
{
mbinfo
<<
myname
<<
"(readInputRegisters): Unknown addr="
<<
ModbusRTU
::
addr2str
(
query
.
addr
)
<<
endl
;
mbinfo
<<
myname
<<
"(readInputRegisters): Unknown addr="
<<
ModbusRTU
::
addr2str
(
query
.
addr
)
<<
endl
;
...
@@ -2110,6 +2118,7 @@ ModbusRTU::mbErrCode MBSlave::readCoilStatus( ReadCoilMessage& query,
...
@@ -2110,6 +2118,7 @@ ModbusRTU::mbErrCode MBSlave::readCoilStatus( ReadCoilMessage& query,
mbinfo
<<
myname
<<
"(readCoilStatus): "
<<
query
<<
endl
;
mbinfo
<<
myname
<<
"(readCoilStatus): "
<<
query
<<
endl
;
auto
regmap
=
iomap
.
find
(
query
.
addr
);
auto
regmap
=
iomap
.
find
(
query
.
addr
);
if
(
regmap
==
iomap
.
end
()
)
if
(
regmap
==
iomap
.
end
()
)
{
{
mbinfo
<<
myname
<<
"(readCoilStatus): Unknown addr="
<<
ModbusRTU
::
addr2str
(
query
.
addr
)
<<
endl
;
mbinfo
<<
myname
<<
"(readCoilStatus): Unknown addr="
<<
ModbusRTU
::
addr2str
(
query
.
addr
)
<<
endl
;
...
@@ -2121,7 +2130,7 @@ ModbusRTU::mbErrCode MBSlave::readCoilStatus( ReadCoilMessage& query,
...
@@ -2121,7 +2130,7 @@ ModbusRTU::mbErrCode MBSlave::readCoilStatus( ReadCoilMessage& query,
if
(
query
.
count
<=
1
)
if
(
query
.
count
<=
1
)
{
{
ModbusRTU
::
ModbusData
d
=
0
;
ModbusRTU
::
ModbusData
d
=
0
;
ModbusRTU
::
mbErrCode
ret
=
real_read
(
regmap
->
second
,
query
.
start
,
d
,
query
.
func
);
ModbusRTU
::
mbErrCode
ret
=
real_read
(
regmap
->
second
,
query
.
start
,
d
,
query
.
func
);
reply
.
addData
(
0
);
reply
.
addData
(
0
);
if
(
ret
==
ModbusRTU
::
erNoError
)
if
(
ret
==
ModbusRTU
::
erNoError
)
...
@@ -2182,6 +2191,7 @@ ModbusRTU::mbErrCode MBSlave::readInputStatus( ReadInputStatusMessage& query,
...
@@ -2182,6 +2191,7 @@ ModbusRTU::mbErrCode MBSlave::readInputStatus( ReadInputStatusMessage& query,
mbinfo
<<
myname
<<
"(readInputStatus): "
<<
query
<<
endl
;
mbinfo
<<
myname
<<
"(readInputStatus): "
<<
query
<<
endl
;
auto
regmap
=
iomap
.
find
(
query
.
addr
);
auto
regmap
=
iomap
.
find
(
query
.
addr
);
if
(
regmap
==
iomap
.
end
()
)
if
(
regmap
==
iomap
.
end
()
)
{
{
mbinfo
<<
myname
<<
"(readInputStatus): Unknown addr="
<<
ModbusRTU
::
addr2str
(
query
.
addr
)
<<
endl
;
mbinfo
<<
myname
<<
"(readInputStatus): Unknown addr="
<<
ModbusRTU
::
addr2str
(
query
.
addr
)
<<
endl
;
...
@@ -2254,6 +2264,7 @@ ModbusRTU::mbErrCode MBSlave::forceMultipleCoils( ModbusRTU::ForceCoilsMessage&
...
@@ -2254,6 +2264,7 @@ ModbusRTU::mbErrCode MBSlave::forceMultipleCoils( ModbusRTU::ForceCoilsMessage&
mbinfo
<<
myname
<<
"(forceMultipleCoils): "
<<
query
<<
endl
;
mbinfo
<<
myname
<<
"(forceMultipleCoils): "
<<
query
<<
endl
;
auto
regmap
=
iomap
.
find
(
query
.
addr
);
auto
regmap
=
iomap
.
find
(
query
.
addr
);
if
(
regmap
==
iomap
.
end
()
)
if
(
regmap
==
iomap
.
end
()
)
{
{
mbinfo
<<
myname
<<
"(forceMultipleCoils): Unknown addr="
<<
ModbusRTU
::
addr2str
(
query
.
addr
)
<<
endl
;
mbinfo
<<
myname
<<
"(forceMultipleCoils): Unknown addr="
<<
ModbusRTU
::
addr2str
(
query
.
addr
)
<<
endl
;
...
@@ -2290,6 +2301,7 @@ ModbusRTU::mbErrCode MBSlave::forceSingleCoil( ModbusRTU::ForceSingleCoilMessage
...
@@ -2290,6 +2301,7 @@ ModbusRTU::mbErrCode MBSlave::forceSingleCoil( ModbusRTU::ForceSingleCoilMessage
mbinfo
<<
myname
<<
"(forceSingleCoil): "
<<
query
<<
endl
;
mbinfo
<<
myname
<<
"(forceSingleCoil): "
<<
query
<<
endl
;
auto
regmap
=
iomap
.
find
(
query
.
addr
);
auto
regmap
=
iomap
.
find
(
query
.
addr
);
if
(
regmap
==
iomap
.
end
()
)
if
(
regmap
==
iomap
.
end
()
)
{
{
mbinfo
<<
myname
<<
"(forceSingleCoil): Unknown addr="
<<
ModbusRTU
::
addr2str
(
query
.
addr
)
<<
endl
;
mbinfo
<<
myname
<<
"(forceSingleCoil): Unknown addr="
<<
ModbusRTU
::
addr2str
(
query
.
addr
)
<<
endl
;
...
...
extensions/ModbusSlave/MBSlave.h
View file @
b2cf6d77
...
@@ -439,7 +439,7 @@ class MBSlave:
...
@@ -439,7 +439,7 @@ class MBSlave:
// то использовать unordered_map нельзя
// то использовать unordered_map нельзя
typedef
std
::
map
<
ModbusRTU
::
RegID
,
IOProperty
>
RegMap
;
typedef
std
::
map
<
ModbusRTU
::
RegID
,
IOProperty
>
RegMap
;
typedef
std
::
unordered_map
<
ModbusRTU
::
ModbusAddr
,
RegMap
>
IOMap
;
typedef
std
::
unordered_map
<
ModbusRTU
::
ModbusAddr
,
RegMap
>
IOMap
;
IOMap
iomap
;
/*!< список входов/выходов по адресам */
IOMap
iomap
;
/*!< список входов/выходов по адресам */
...
...
extensions/RRDServer/RRDServer.cc
View file @
b2cf6d77
...
@@ -12,7 +12,7 @@ using namespace UniSetTypes;
...
@@ -12,7 +12,7 @@ using namespace UniSetTypes;
using
namespace
UniSetExtensions
;
using
namespace
UniSetExtensions
;
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
RRDServer
::
RRDServer
(
UniSetTypes
::
ObjectId
objId
,
xmlNode
*
cnode
,
UniSetTypes
::
ObjectId
shmId
,
const
std
::
shared_ptr
<
SharedMemory
>&
ic
,
RRDServer
::
RRDServer
(
UniSetTypes
::
ObjectId
objId
,
xmlNode
*
cnode
,
UniSetTypes
::
ObjectId
shmId
,
const
std
::
shared_ptr
<
SharedMemory
>&
ic
,
const
string
&
prefix
)
:
const
string
&
prefix
)
:
UObject_SK
(
objId
,
cnode
,
string
(
prefix
+
"-"
)),
UObject_SK
(
objId
,
cnode
,
string
(
prefix
+
"-"
)),
prefix
(
prefix
)
prefix
(
prefix
)
{
{
...
@@ -156,6 +156,7 @@ void RRDServer::initRRD( xmlNode* cnode, int tmID )
...
@@ -156,6 +156,7 @@ void RRDServer::initRRD( xmlNode* cnode, int tmID )
}
}
std
::
string
dsname
(
it1
.
getProp
(
ds
));
std
::
string
dsname
(
it1
.
getProp
(
ds
));
if
(
dsname
.
empty
()
)
if
(
dsname
.
empty
()
)
dsname
=
it1
.
getProp
(
"name"
);
dsname
=
it1
.
getProp
(
"name"
);
...
...
extensions/SharedMemory/SharedMemory.h
View file @
b2cf6d77
...
@@ -415,26 +415,26 @@ class SharedMemory:
...
@@ -415,26 +415,26 @@ class SharedMemory:
class
HeartBeatInfo
class
HeartBeatInfo
{
{
public
:
public
:
HeartBeatInfo
()
:
HeartBeatInfo
()
:
a_sid
(
UniSetTypes
::
DefaultObjectId
),
a_sid
(
UniSetTypes
::
DefaultObjectId
),
d_sid
(
UniSetTypes
::
DefaultObjectId
),
d_sid
(
UniSetTypes
::
DefaultObjectId
),
reboot_msec
(
UniSetTimer
::
WaitUpTime
),
reboot_msec
(
UniSetTimer
::
WaitUpTime
),
timer_running
(
false
),
timer_running
(
false
),
ptReboot
(
UniSetTimer
::
WaitUpTime
)
ptReboot
(
UniSetTimer
::
WaitUpTime
)
{}
{}
UniSetTypes
::
ObjectId
a_sid
;
// аналоговый счётчик
UniSetTypes
::
ObjectId
a_sid
;
// аналоговый счётчик
UniSetTypes
::
ObjectId
d_sid
;
// дискретный датчик состояния процесса
UniSetTypes
::
ObjectId
d_sid
;
// дискретный датчик состояния процесса
IOStateList
::
iterator
a_it
;
IOStateList
::
iterator
a_it
;
IOStateList
::
iterator
d_it
;
IOStateList
::
iterator
d_it
;
timeout_t
reboot_msec
;
/*!< Время в течение которого процесс обязан подтвердить своё существование,
timeout_t
reboot_msec
;
/*!< Время в течение которого процесс обязан подтвердить своё существование,
иначе будет произведена перезагрузка контроллера по WDT (в случае если он включён).
иначе будет произведена перезагрузка контроллера по WDT (в случае если он включён).
Если данный параметр не указывать, то "не живость" процесса просто игнорируется
Если данный параметр не указывать, то "не живость" процесса просто игнорируется
(т.е. только сброс датчика heartbeat (d_sid) в ноль). */
(т.е. только сброс датчика heartbeat (d_sid) в ноль). */
bool
timer_running
;
bool
timer_running
;
PassiveTimer
ptReboot
;
PassiveTimer
ptReboot
;
};
};
enum
Timers
enum
Timers
...
...
extensions/UNetUDP/UNetExchange.cc
View file @
b2cf6d77
...
@@ -457,6 +457,7 @@ void UNetExchange::waitSMReady()
...
@@ -457,6 +457,7 @@ void UNetExchange::waitSMReady()
int
tout
=
uniset_conf
()
->
getArgInt
(
"--unet-sm-ready-timeout"
,
"15000"
);
int
tout
=
uniset_conf
()
->
getArgInt
(
"--unet-sm-ready-timeout"
,
"15000"
);
timeout_t
ready_timeout
=
15000
;
timeout_t
ready_timeout
=
15000
;
if
(
tout
>
0
)
if
(
tout
>
0
)
ready_timeout
=
tout
;
ready_timeout
=
tout
;
else
if
(
tout
<
0
)
else
if
(
tout
<
0
)
...
...
extensions/UNetUDP/unet-udp-tester.cc
View file @
b2cf6d77
...
@@ -76,6 +76,7 @@ int main(int argc, char* argv[])
...
@@ -76,6 +76,7 @@ int main(int argc, char* argv[])
while
(
1
)
while
(
1
)
{
{
opt
=
getopt_long
(
argc
,
argv
,
"hs:c:r:p:n:t:x:blvdz:y:"
,
longopts
,
&
optindex
);
opt
=
getopt_long
(
argc
,
argv
,
"hs:c:r:p:n:t:x:blvdz:y:"
,
longopts
,
&
optindex
);
if
(
opt
==
-
1
)
if
(
opt
==
-
1
)
break
;
break
;
...
...
extensions/UniNetwork/UniExchange.cc
View file @
b2cf6d77
...
@@ -18,7 +18,7 @@ UniExchange::NetNodeInfo::NetNodeInfo():
...
@@ -18,7 +18,7 @@ UniExchange::NetNodeInfo::NetNodeInfo():
}
}
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
UniExchange
::
UniExchange
(
UniSetTypes
::
ObjectId
id
,
UniSetTypes
::
ObjectId
shmID
,
UniExchange
::
UniExchange
(
UniSetTypes
::
ObjectId
id
,
UniSetTypes
::
ObjectId
shmID
,
const
std
::
shared_ptr
<
SharedMemory
>&
ic
,
const
std
::
string
&
prefix
)
:
const
std
::
shared_ptr
<
SharedMemory
>&
ic
,
const
std
::
string
&
prefix
)
:
IOController
(
id
),
IOController
(
id
),
polltime
(
200
),
polltime
(
200
),
mymap
(
1
),
mymap
(
1
),
...
...
extensions/include/MTR.h
View file @
b2cf6d77
...
@@ -296,7 +296,7 @@ namespace MTR
...
@@ -296,7 +296,7 @@ namespace MTR
val
=
raw
.
u2
.
val
*
pow
(
(
long
)
10
,
(
long
)
raw
.
u2
.
exp
);
val
=
raw
.
u2
.
val
*
pow
(
(
long
)
10
,
(
long
)
raw
.
u2
.
exp
);
}
}
T5
(
const
ModbusRTU
::
ModbusData
*
data
,
int
size
)
:
val
(
0
)
T5
(
const
ModbusRTU
::
ModbusData
*
data
,
int
size
)
:
val
(
0
)
{
{
if
(
size
>=
u2size
)
if
(
size
>=
u2size
)
{
{
...
...
extensions/include/UObject_SK.h
View file @
b2cf6d77
This diff is collapsed.
Click to expand it.
extensions/lib/IOBase.cc
View file @
b2cf6d77
...
@@ -579,12 +579,12 @@ bool IOBase::initItem( IOBase* b, UniXML::iterator& it, const std::shared_ptr<SM
...
@@ -579,12 +579,12 @@ bool IOBase::initItem( IOBase* b, UniXML::iterator& it, const std::shared_ptr<SM
&&
d_on_msec
!=
UniSetTimer
::
WaitUpTime
&&
d_on_msec
!=
UniSetTimer
::
WaitUpTime
&&
d_off_msec
!=
UniSetTimer
::
WaitUpTime
)
&&
d_off_msec
!=
UniSetTimer
::
WaitUpTime
)
{
{
dlog
->
warn
()
<<
myname
<<
"(IOBase::readItem): "
dlog
->
warn
()
<<
myname
<<
"(IOBase::readItem): "
<<
" 'debouncedelay' is used in conjunction with the 'ondelay' and 'offdelay'. Sure?"
<<
" 'debouncedelay' is used in conjunction with the 'ondelay' and 'offdelay'. Sure?"
<<
" [ debouncedelay="
<<
d_msec
<<
" [ debouncedelay="
<<
d_msec
<<
" ondelay="
<<
d_on_msec
<<
" ondelay="
<<
d_on_msec
<<
" offdelay="
<<
d_off_msec
<<
" offdelay="
<<
d_off_msec
<<
" ]"
<<
endl
;
<<
" ]"
<<
endl
;
}
}
...
...
extensions/lib/MTR.cc
View file @
b2cf6d77
...
@@ -614,8 +614,8 @@ namespace MTR
...
@@ -614,8 +614,8 @@ namespace MTR
{
{
std
::
ios_base
::
fmtflags
old_flags
=
os
.
flags
();
std
::
ios_base
::
fmtflags
old_flags
=
os
.
flags
();
os
<<
setfill
(
'0'
)
<<
hex
os
<<
setfill
(
'0'
)
<<
hex
<<
setw
(
2
)
<<
t
.
hour
()
<<
":"
<<
setw
(
2
)
<<
t
.
min
()
<<
setw
(
2
)
<<
t
.
hour
()
<<
":"
<<
setw
(
2
)
<<
t
.
min
()
<<
" "
<<
setw
(
2
)
<<
t
.
day
()
<<
"/"
<<
setw
(
2
)
<<
t
.
mon
();
<<
" "
<<
setw
(
2
)
<<
t
.
day
()
<<
"/"
<<
setw
(
2
)
<<
t
.
mon
();
os
.
setf
(
old_flags
);
os
.
setf
(
old_flags
);
return
os
;
return
os
;
}
}
...
@@ -623,8 +623,8 @@ namespace MTR
...
@@ -623,8 +623,8 @@ namespace MTR
{
{
std
::
ios_base
::
fmtflags
old_flags
=
os
.
flags
();
std
::
ios_base
::
fmtflags
old_flags
=
os
.
flags
();
os
<<
setfill
(
'0'
)
<<
hex
os
<<
setfill
(
'0'
)
<<
hex
<<
setw
(
2
)
<<
t
.
hour
()
<<
":"
<<
setw
(
2
)
<<
t
.
min
()
<<
setw
(
2
)
<<
t
.
hour
()
<<
":"
<<
setw
(
2
)
<<
t
.
min
()
<<
":"
<<
setw
(
2
)
<<
t
.
sec
()
<<
"."
<<
setw
(
2
)
<<
t
.
ssec
();
<<
":"
<<
setw
(
2
)
<<
t
.
sec
()
<<
"."
<<
setw
(
2
)
<<
t
.
ssec
();
os
.
setf
(
old_flags
);
os
.
setf
(
old_flags
);
return
os
;
return
os
;
}
}
...
@@ -632,8 +632,8 @@ namespace MTR
...
@@ -632,8 +632,8 @@ namespace MTR
{
{
std
::
ios_base
::
fmtflags
old_flags
=
os
.
flags
();
std
::
ios_base
::
fmtflags
old_flags
=
os
.
flags
();
os
<<
setfill
(
'0'
)
<<
dec
os
<<
setfill
(
'0'
)
<<
dec
<<
setw
(
4
)
<<
t
.
year
()
<<
"/"
<<
setw
(
2
)
<<
t
.
mon
()
<<
setw
(
4
)
<<
t
.
year
()
<<
"/"
<<
setw
(
2
)
<<
t
.
mon
()
<<
"/"
<<
setw
(
2
)
<<
t
.
day
();
<<
"/"
<<
setw
(
2
)
<<
t
.
day
();
os
.
setf
(
old_flags
);
os
.
setf
(
old_flags
);
return
os
;
return
os
;
}
}
...
...
extensions/lib/UObject_SK.cc
View file @
b2cf6d77
This diff is collapsed.
Click to expand it.
include/LT_Object.h
View file @
b2cf6d77
...
@@ -109,7 +109,7 @@ class LT_Object
...
@@ -109,7 +109,7 @@ class LT_Object
\return Возвращает время [мсек] оставшееся до срабатывания очередного таймера
\return Возвращает время [мсек] оставшееся до срабатывания очередного таймера
*/
*/
virtual
timeout_t
askTimer
(
UniSetTypes
::
TimerId
timerid
,
timeout_t
timeMS
,
clock_t
ticks
=
-
1
,
virtual
timeout_t
askTimer
(
UniSetTypes
::
TimerId
timerid
,
timeout_t
timeMS
,
clock_t
ticks
=
-
1
,
UniSetTypes
::
Message
::
Priority
p
=
UniSetTypes
::
Message
::
High
);
UniSetTypes
::
Message
::
Priority
p
=
UniSetTypes
::
Message
::
High
);
/*!
/*!
...
...
include/Trigger.h
View file @
b2cf6d77
...
@@ -72,7 +72,10 @@ class Trigger
...
@@ -72,7 +72,10 @@ class Trigger
return
false
;
return
false
;
}
}
inline
bool
get
(){
return
oldstate
;
}
inline
bool
get
()
{
return
oldstate
;
}
private
:
private
:
bool
oldstate
;
/*!< предыдущее состояние */
bool
oldstate
;
/*!< предыдущее состояние */
...
...
include/UniSetManager.h
View file @
b2cf6d77
...
@@ -152,7 +152,7 @@ class UniSetManager:
...
@@ -152,7 +152,7 @@ class UniSetManager:
typedef
UniSetManagerList
::
iterator
MListIterator
;
typedef
UniSetManagerList
::
iterator
MListIterator
;
int
getObjectsInfo
(
const
std
::
shared_ptr
<
UniSetManager
>&
mngr
,
UniSetTypes
::
SimpleInfoSeq
*
seq
,
int
getObjectsInfo
(
const
std
::
shared_ptr
<
UniSetManager
>&
mngr
,
UniSetTypes
::
SimpleInfoSeq
*
seq
,
int
begin
,
const
long
uplimit
,
CORBA
::
Long
userparam
);
int
begin
,
const
long
uplimit
,
CORBA
::
Long
userparam
);
PortableServer
::
POA_var
poa
;
PortableServer
::
POA_var
poa
;
PortableServer
::
POAManager_var
pman
;
PortableServer
::
POAManager_var
pman
;
...
...
include/UniSetObject.h
View file @
b2cf6d77
...
@@ -116,6 +116,9 @@ class UniSetObject:
...
@@ -116,6 +116,9 @@ class UniSetObject:
return
(
UniSetTypes
::
ObjectPtr
)
CORBA
::
Object
::
_duplicate
(
oref
);
return
(
UniSetTypes
::
ObjectPtr
)
CORBA
::
Object
::
_duplicate
(
oref
);
}
}
virtual
timeout_t
askTimer
(
UniSetTypes
::
TimerId
timerid
,
timeout_t
timeMS
,
clock_t
ticks
=
-
1
,
UniSetTypes
::
Message
::
Priority
p
=
UniSetTypes
::
Message
::
High
)
override
;
protected
:
protected
:
/*! обработка приходящих сообщений */
/*! обработка приходящих сообщений */
virtual
void
processingMessage
(
UniSetTypes
::
VoidMessage
*
msg
);
virtual
void
processingMessage
(
UniSetTypes
::
VoidMessage
*
msg
);
...
@@ -123,9 +126,6 @@ class UniSetObject:
...
@@ -123,9 +126,6 @@ class UniSetObject:
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
timeout_t
askTimer
(
UniSetTypes
::
TimerId
timerid
,
timeout_t
timeMS
,
clock_t
ticks
=
-
1
,
UniSetTypes
::
Message
::
Priority
p
=
UniSetTypes
::
Message
::
High
)
override
;
/*! Получить сообщение */
/*! Получить сообщение */
bool
receiveMessage
(
UniSetTypes
::
VoidMessage
&
vm
);
bool
receiveMessage
(
UniSetTypes
::
VoidMessage
&
vm
);
...
...
python/lib/pyUniSet/UModbus.cc
View file @
b2cf6d77
...
@@ -123,7 +123,7 @@ bool UModbus::getBit( int addr, int mbreg, int mbfunc )throw(UException)
...
@@ -123,7 +123,7 @@ bool UModbus::getBit( int addr, int mbreg, int mbfunc )throw(UException)
}
}
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
long
UModbus
::
mbread
(
int
mbaddr
,
int
mbreg
,
int
mbfunc
,
const
string
&
s_vtype
,
int
nbit
,
long
UModbus
::
mbread
(
int
mbaddr
,
int
mbreg
,
int
mbfunc
,
const
string
&
s_vtype
,
int
nbit
,
const
string
&
new_ip
,
int
new_port
)
throw
(
UException
)
const
string
&
new_ip
,
int
new_port
)
throw
(
UException
)
{
{
using
namespace
VTypes
;
using
namespace
VTypes
;
...
...
src/Communications/Modbus/ModbusClient.cc
View file @
b2cf6d77
...
@@ -994,7 +994,7 @@ mbErrCode ModbusClient::recv_pdu( ModbusByte qfunc, ModbusMessage& rbuf, timeout
...
@@ -994,7 +994,7 @@ mbErrCode ModbusClient::recv_pdu( ModbusByte qfunc, ModbusMessage& rbuf, timeout
{
{
size_t
onum
=
0
;
size_t
onum
=
0
;
while
(
(
rlen
+
2
)
<
sizeof
(
rbuf
.
data
)
&&
onum
<
mPreRDI
.
objNum
)
while
(
(
rlen
+
2
)
<
sizeof
(
rbuf
.
data
)
&&
onum
<
mPreRDI
.
objNum
)
{
{
// сперва получаем два байта, для определения длины последующих данных
// сперва получаем два байта, для определения длины последующих данных
size_t
szDataLen
=
2
;
// object id + len
size_t
szDataLen
=
2
;
// object id + len
...
...
src/Communications/Modbus/ModbusRTUSlave.cc
View file @
b2cf6d77
...
@@ -96,7 +96,8 @@ mbErrCode ModbusRTUSlave::receive(const std::unordered_set<ModbusAddr>& vmbaddr,
...
@@ -96,7 +96,8 @@ mbErrCode ModbusRTUSlave::receive(const std::unordered_set<ModbusAddr>& vmbaddr,
if
(
aftersend_msec
>
0
)
if
(
aftersend_msec
>
0
)
msleep
(
aftersend_msec
);
msleep
(
aftersend_msec
);
// usleep(10000);
// usleep(10000);
return
res
;
return
res
;
}
}
...
...
src/Communications/Modbus/ModbusServer.cc
View file @
b2cf6d77
...
@@ -72,16 +72,18 @@ bool ModbusServer::checkAddr(const std::unordered_set<ModbusAddr>& vaddr, const
...
@@ -72,16 +72,18 @@ bool ModbusServer::checkAddr(const std::unordered_set<ModbusAddr>& vaddr, const
return
true
;
return
true
;
auto
i
=
vaddr
.
find
(
addr
);
auto
i
=
vaddr
.
find
(
addr
);
return
(
i
!=
vaddr
.
end
());
return
(
i
!=
vaddr
.
end
());
}
}
// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
std
::
string
ModbusServer
::
vaddr2str
(
const
std
::
unordered_set
<
ModbusAddr
>&
vaddr
)
std
::
string
ModbusServer
::
vaddr2str
(
const
std
::
unordered_set
<
ModbusAddr
>&
vaddr
)
{
{
ostringstream
s
;
ostringstream
s
;
s
<<
"[ "
;
s
<<
"[ "
;
for
(
const
auto
&
a
:
vaddr
)
for
(
const
auto
&
a
:
vaddr
)
s
<<
addr2str
(
a
)
<<
" "
;
s
<<
addr2str
(
a
)
<<
" "
;
s
<<
"]"
;
s
<<
"]"
;
return
std
::
move
(
s
.
str
());
return
std
::
move
(
s
.
str
());
}
}
...
@@ -583,7 +585,7 @@ mbErrCode ModbusServer::recv( const std::unordered_set<ModbusRTU::ModbusAddr>& v
...
@@ -583,7 +585,7 @@ mbErrCode ModbusServer::recv( const std::unordered_set<ModbusRTU::ModbusAddr>& v
{
{
bcnt
=
getNextData
((
unsigned
char
*
)(
&
rbuf
),
sizeof
(
ModbusAddr
));
bcnt
=
getNextData
((
unsigned
char
*
)(
&
rbuf
),
sizeof
(
ModbusAddr
));
if
(
bcnt
>
0
&&
checkAddr
(
vaddr
,
rbuf
.
addr
)
)
if
(
bcnt
>
0
&&
checkAddr
(
vaddr
,
rbuf
.
addr
)
)
{
{
begin
=
true
;
begin
=
true
;
break
;
break
;
...
@@ -599,7 +601,7 @@ mbErrCode ModbusServer::recv( const std::unordered_set<ModbusRTU::ModbusAddr>& v
...
@@ -599,7 +601,7 @@ mbErrCode ModbusServer::recv( const std::unordered_set<ModbusRTU::ModbusAddr>& v
// Lav: конечно стоит, нам же надо буфер чистить
// Lav: конечно стоит, нам же надо буфер чистить
*/
*/
// Проверка кому адресован пакет... (только если не включён режим отвечать на любые адреса)
// Проверка кому адресован пакет... (только если не включён режим отвечать на любые адреса)
if
(
!
(
onBroadcast
&&
rbuf
.
addr
==
BroadcastAddr
)
&&
!
checkAddr
(
vaddr
,
rbuf
.
addr
)
)
if
(
!
(
onBroadcast
&&
rbuf
.
addr
==
BroadcastAddr
)
&&
!
checkAddr
(
vaddr
,
rbuf
.
addr
)
)
{
{
if
(
dlog
->
is_warn
()
)
if
(
dlog
->
is_warn
()
)
{
{
...
@@ -1505,7 +1507,7 @@ std::unordered_set<ModbusAddr> ModbusServer::addr2vaddr(ModbusAddr& mbaddr)
...
@@ -1505,7 +1507,7 @@ std::unordered_set<ModbusAddr> ModbusServer::addr2vaddr(ModbusAddr& mbaddr)
mbErrCode
ModbusServer
::
receive_one
(
ModbusAddr
a
,
timeout_t
msec
)
mbErrCode
ModbusServer
::
receive_one
(
ModbusAddr
a
,
timeout_t
msec
)
{
{
auto
v
=
addr2vaddr
(
a
);
auto
v
=
addr2vaddr
(
a
);
return
receive
(
v
,
msec
);
return
receive
(
v
,
msec
);
}
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
...
@@ -1548,6 +1550,7 @@ ModbusRTU::mbErrCode ModbusServer::replyFileTransfer( const std::string& fname,
...
@@ -1548,6 +1550,7 @@ ModbusRTU::mbErrCode ModbusServer::replyFileTransfer( const std::string& fname,
if
(
ret
==
-
1
)
if
(
ret
==
-
1
)
{
{
close
(
fd
);
close
(
fd
);
if
(
dlog
&&
dlog
->
is_warn
()
)
if
(
dlog
&&
dlog
->
is_warn
()
)
(
*
dlog
)[
Debug
::
WARN
]
<<
"(replyFileTransfer): open '"
<<
fname
<<
"' with error: "
<<
strerror
(
errno
)
<<
endl
;
(
*
dlog
)[
Debug
::
WARN
]
<<
"(replyFileTransfer): open '"
<<
fname
<<
"' with error: "
<<
strerror
(
errno
)
<<
endl
;
...
@@ -1561,6 +1564,7 @@ ModbusRTU::mbErrCode ModbusServer::replyFileTransfer( const std::string& fname,
...
@@ -1561,6 +1564,7 @@ ModbusRTU::mbErrCode ModbusServer::replyFileTransfer( const std::string& fname,
if
(
ret
<
0
)
if
(
ret
<
0
)
{
{
close
(
fd
);
close
(
fd
);
if
(
dlog
&&
dlog
->
is_warn
()
)
if
(
dlog
&&
dlog
->
is_warn
()
)
(
*
dlog
)[
Debug
::
WARN
]
<<
"(replyFileTransfer): read from '"
<<
fname
<<
"' with error: "
<<
strerror
(
errno
)
<<
endl
;
(
*
dlog
)[
Debug
::
WARN
]
<<
"(replyFileTransfer): read from '"
<<
fname
<<
"' with error: "
<<
strerror
(
errno
)
<<
endl
;
...
@@ -1572,6 +1576,7 @@ ModbusRTU::mbErrCode ModbusServer::replyFileTransfer( const std::string& fname,
...
@@ -1572,6 +1576,7 @@ ModbusRTU::mbErrCode ModbusServer::replyFileTransfer( const std::string& fname,
if
(
fstat
(
fd
,
&
fs
)
<
0
)
if
(
fstat
(
fd
,
&
fs
)
<
0
)
{
{
close
(
fd
);
close
(
fd
);
if
(
dlog
&&
dlog
->
is_warn
()
)
if
(
dlog
&&
dlog
->
is_warn
()
)
(
*
dlog
)[
Debug
::
WARN
]
<<
"(replyFileTransfer): fstat for '"
<<
fname
<<
"' with error: "
<<
strerror
(
errno
)
<<
endl
;
(
*
dlog
)[
Debug
::
WARN
]
<<
"(replyFileTransfer): fstat for '"
<<
fname
<<
"' with error: "
<<
strerror
(
errno
)
<<
endl
;
...
@@ -1620,7 +1625,7 @@ ModbusRTU::mbErrCode ModbusServer::replySetDateTime( ModbusRTU::SetDateTimeMessa
...
@@ -1620,7 +1625,7 @@ ModbusRTU::mbErrCode ModbusServer::replySetDateTime( ModbusRTU::SetDateTimeMessa
set
.
tv_sec
=
mktime
(
&
t
);
// может вернуть -1 (!)
set
.
tv_sec
=
mktime
(
&
t
);
// может вернуть -1 (!)
set
.
tv_usec
=
0
;
set
.
tv_usec
=
0
;
if
(
set
.
tv_sec
>=
0
&&
settimeofday
(
&
set
,
&
tz
)
==
0
)
if
(
set
.
tv_sec
>=
0
&&
settimeofday
(
&
set
,
&
tz
)
==
0
)
{
{
// подтверждаем сохранение
// подтверждаем сохранение
// в ответе возвращаем установленное время...
// в ответе возвращаем установленное время...
...
...
src/Communications/Modbus/ModbusTCPCore.cc
View file @
b2cf6d77
...
@@ -4,7 +4,7 @@ using namespace std;
...
@@ -4,7 +4,7 @@ using namespace std;
using
namespace
ModbusRTU
;
using
namespace
ModbusRTU
;
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
size_t
ModbusTCPCore
::
readNextData
(
ost
::
TCPStream
*
tcp
,
size_t
ModbusTCPCore
::
readNextData
(
ost
::
TCPStream
*
tcp
,
std
::
queue
<
unsigned
char
>&
qrecv
,
int
max
)
std
::
queue
<
unsigned
char
>&
qrecv
,
int
max
)
{
{
if
(
!
tcp
||
!
tcp
->
isConnected
()
)
if
(
!
tcp
||
!
tcp
->
isConnected
()
)
return
0
;
return
0
;
...
@@ -26,8 +26,8 @@ size_t ModbusTCPCore::readNextData( ost::TCPStream* tcp,
...
@@ -26,8 +26,8 @@ size_t ModbusTCPCore::readNextData( ost::TCPStream* tcp,
}
}
// ------------------------------------------------------------------------
// ------------------------------------------------------------------------
size_t
ModbusTCPCore
::
getNextData
(
ost
::
TCPStream
*
tcp
,
size_t
ModbusTCPCore
::
getNextData
(
ost
::
TCPStream
*
tcp
,
std
::
queue
<
unsigned
char
>&
qrecv
,
std
::
queue
<
unsigned
char
>&
qrecv
,
unsigned
char
*
buf
,
size_t
len
)
unsigned
char
*
buf
,
size_t
len
)
{
{
if
(
!
tcp
||
!
tcp
->
isConnected
()
)
if
(
!
tcp
||
!
tcp
->
isConnected
()
)
return
0
;
return
0
;
...
...
src/Communications/Modbus/ModbusTCPServer.cc
View file @
b2cf6d77
...
@@ -232,6 +232,7 @@ mbErrCode ModbusTCPServer::receive(const std::unordered_set<ModbusAddr>& vmbaddr
...
@@ -232,6 +232,7 @@ mbErrCode ModbusTCPServer::receive(const std::unordered_set<ModbusAddr>& vmbaddr
{
{
if
(
dlog
->
is_crit
()
)
if
(
dlog
->
is_crit
()
)
dlog
->
crit
()
<<
"(ModbusTCPServer): "
<<
e
.
what
()
<<
endl
;
dlog
->
crit
()
<<
"(ModbusTCPServer): "
<<
e
.
what
()
<<
endl
;
return
erInternalErrorCode
;
return
erInternalErrorCode
;
}
}
...
...
src/Communications/Modbus/ModbusTCPSession.cc
View file @
b2cf6d77
...
@@ -33,8 +33,9 @@ ModbusTCPSession::ModbusTCPSession(ost::TCPSocket& server, const std::unordered_
...
@@ -33,8 +33,9 @@ ModbusTCPSession::ModbusTCPSession(ost::TCPSocket& server, const std::unordered_
{
{
setCRCNoCheckit
(
true
);
setCRCNoCheckit
(
true
);
timeout_t
tout
=
timeout
/
1000
;
timeout_t
tout
=
timeout
/
1000
;
if
(
tout
<=
0
)
if
(
tout
<=
0
)
tout
=
3
;
tout
=
3
;
setKeepAlive
(
true
);
setKeepAlive
(
true
);
...
...
src/Communications/Modbus/ModbusTypes.cc
View file @
b2cf6d77
...
@@ -997,6 +997,7 @@ ModbusMessage ReadOutputRetMessage::transport_msg()
...
@@ -997,6 +997,7 @@ ModbusMessage ReadOutputRetMessage::transport_msg()
ind
+=
bcnt
;
ind
+=
bcnt
;
}
}
// пересчитываем CRC по перевёрнутым данным
// пересчитываем CRC по перевёрнутым данным
ModbusData
crc
=
checkCRC
(
(
ModbusByte
*
)(
&
mm
),
szModbusHeader
+
sizeof
(
bcnt
)
+
bcnt
);
ModbusData
crc
=
checkCRC
(
(
ModbusByte
*
)(
&
mm
),
szModbusHeader
+
sizeof
(
bcnt
)
+
bcnt
);
...
@@ -1209,6 +1210,7 @@ ModbusMessage ReadInputRetMessage::transport_msg()
...
@@ -1209,6 +1210,7 @@ ModbusMessage ReadInputRetMessage::transport_msg()
ind
+=
bcnt
;
ind
+=
bcnt
;
}
}
// пересчитываем CRC по перевёрнутым данным
// пересчитываем CRC по перевёрнутым данным
ModbusData
crc
=
checkCRC
(
(
ModbusByte
*
)(
&
mm
),
szModbusHeader
+
sizeof
(
bcnt
)
+
bcnt
);
ModbusData
crc
=
checkCRC
(
(
ModbusByte
*
)(
&
mm
),
szModbusHeader
+
sizeof
(
bcnt
)
+
bcnt
);
...
...
src/Communications/TCP/UTCPStream.cc
View file @
b2cf6d77
...
@@ -28,6 +28,7 @@ bool UTCPStream::setKeepAliveParams(timeout_t timeout_sec, int keepcnt, int keep
...
@@ -28,6 +28,7 @@ bool UTCPStream::setKeepAliveParams(timeout_t timeout_sec, int keepcnt, int keep
SOCKET
fd
=
TCPStream
::
so
;
SOCKET
fd
=
TCPStream
::
so
;
int
enable
=
1
;
int
enable
=
1
;
bool
ok
=
true
;
bool
ok
=
true
;
if
(
setsockopt
(
fd
,
SOL_SOCKET
,
SO_KEEPALIVE
,
(
void
*
)
&
enable
,
sizeof
(
enable
))
==
-
1
)
if
(
setsockopt
(
fd
,
SOL_SOCKET
,
SO_KEEPALIVE
,
(
void
*
)
&
enable
,
sizeof
(
enable
))
==
-
1
)
ok
=
false
;
ok
=
false
;
...
...
src/Log/LogReader.cc
View file @
b2cf6d77
...
@@ -307,7 +307,7 @@ void LogReader::readlogs( const std::string& _addr, ost::tpport_t _port, LogServ
...
@@ -307,7 +307,7 @@ void LogReader::readlogs( const std::string& _addr, ost::tpport_t _port, LogServ
log
<<
buf
;
log
<<
buf
;
}
}
else
if
(
n
==
0
&&
readcount
<=
0
)
else
if
(
n
==
0
&&
readcount
<=
0
)
break
;
break
;
if
(
rcount
>
0
&&
readcount
>
0
)
if
(
rcount
>
0
&&
readcount
>
0
)
...
...
src/Log/LogServer.cc
View file @
b2cf6d77
...
@@ -31,6 +31,7 @@ LogServer::~LogServer()
...
@@ -31,6 +31,7 @@ LogServer::~LogServer()
if
(
thr
)
if
(
thr
)
{
{
thr
->
stop
();
thr
->
stop
();
if
(
thr
->
isRunning
()
)
if
(
thr
->
isRunning
()
)
thr
->
join
();
thr
->
join
();
}
}
...
...
src/Log/LogSession.cc
View file @
b2cf6d77
...
@@ -19,6 +19,7 @@ using namespace UniSetTypes;
...
@@ -19,6 +19,7 @@ using namespace UniSetTypes;
LogSession
::~
LogSession
()
LogSession
::~
LogSession
()
{
{
cancelled
=
true
;
cancelled
=
true
;
if
(
isRunning
()
)
if
(
isRunning
()
)
{
{
ost
::
Thread
::
join
();
ost
::
Thread
::
join
();
...
@@ -310,6 +311,7 @@ void LogSession::run()
...
@@ -310,6 +311,7 @@ void LogSession::run()
disconnect
();
disconnect
();
cancelled
=
true
;
cancelled
=
true
;
if
(
slog
.
debugging
(
Debug
::
INFO
)
)
if
(
slog
.
debugging
(
Debug
::
INFO
)
)
slog
[
Debug
::
INFO
]
<<
peername
<<
"(run): thread stopping..."
<<
endl
;
slog
[
Debug
::
INFO
]
<<
peername
<<
"(run): thread stopping..."
<<
endl
;
...
@@ -325,6 +327,7 @@ void LogSession::final()
...
@@ -325,6 +327,7 @@ void LogSession::final()
try
try
{
{
auto
s
=
shared_from_this
();
auto
s
=
shared_from_this
();
if
(
s
)
if
(
s
)
slFin
(
s
);
slFin
(
s
);
}
}
...
@@ -350,8 +353,8 @@ NullLogSession::~NullLogSession()
...
@@ -350,8 +353,8 @@ NullLogSession::~NullLogSession()
{
{
cancelled
=
true
;
cancelled
=
true
;
// if( isRunning() )
// if( isRunning() )
// exit(); // terminate();
// exit(); // terminate();
}
}
// ---------------------------------------------------------------------
// ---------------------------------------------------------------------
void
NullLogSession
::
add
(
ost
::
TCPSocket
&
sock
)
void
NullLogSession
::
add
(
ost
::
TCPSocket
&
sock
)
...
...
src/ObjectRepository/UniSetActivator.cc
View file @
b2cf6d77
...
@@ -204,11 +204,14 @@ void terminate_thread()
...
@@ -204,11 +204,14 @@ void terminate_thread()
g_act
->
terminated
(
g_signo
);
g_act
->
terminated
(
g_signo
);
#if 0
#if 0
try
try
{
{
ulogsys << "TERMINATE THREAD: orb shutdown.." << endl;
ulogsys << "TERMINATE THREAD: orb shutdown.." << endl;
if( g_act->orb )
if( g_act->orb )
g_act->orb->shutdown(true);
g_act->orb->shutdown(true);
ulogsys << "TERMINATE THREAD: orb shutdown ok.." << endl;
ulogsys << "TERMINATE THREAD: orb shutdown ok.." << endl;
}
}
catch( const omniORB::fatalException& fe )
catch( const omniORB::fatalException& fe )
...
@@ -222,7 +225,9 @@ void terminate_thread()
...
@@ -222,7 +225,9 @@ void terminate_thread()
{
{
ulogsys << "(TERMINATE THREAD): " << ex.what() << endl;
ulogsys << "(TERMINATE THREAD): " << ex.what() << endl;
}
}
#endif
#endif
if
(
g_fini_thread
&&
g_fini_thread
->
joinable
()
)
if
(
g_fini_thread
&&
g_fini_thread
->
joinable
()
)
g_fini_thread
->
join
();
g_fini_thread
->
join
();
...
@@ -385,8 +390,10 @@ void UniSetActivator::uaDestroy(int signo)
...
@@ -385,8 +390,10 @@ void UniSetActivator::uaDestroy(int signo)
try
try
{
{
ulogsys
<<
myname
<<
"(uaDestroy): shutdown orb... "
<<
endl
;
ulogsys
<<
myname
<<
"(uaDestroy): shutdown orb... "
<<
endl
;
if
(
orb
)
if
(
orb
)
orb
->
shutdown
(
true
);
orb
->
shutdown
(
true
);
ulogsys
<<
myname
<<
"(uaDestroy): shutdown ok."
<<
endl
;
ulogsys
<<
myname
<<
"(uaDestroy): shutdown ok."
<<
endl
;
}
}
catch
(
const
omniORB
::
fatalException
&
fe
)
catch
(
const
omniORB
::
fatalException
&
fe
)
...
...
src/ObjectRepository/UniSetObject.cc
View file @
b2cf6d77
...
@@ -133,6 +133,7 @@ UniSetObject::UniSetObject( const string& name, const string& section ):
...
@@ -133,6 +133,7 @@ UniSetObject::UniSetObject( const string& name, const string& section ):
UniSetObject
::~
UniSetObject
()
UniSetObject
::~
UniSetObject
()
{
{
#if 0
#if 0
try
try
{
{
deactivate();
deactivate();
...
@@ -156,6 +157,7 @@ UniSetObject::~UniSetObject()
...
@@ -156,6 +157,7 @@ UniSetObject::~UniSetObject()
}
}
catch(...) {}
catch(...) {}
}
}
#endif
#endif
}
}
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
...
...
src/Various/Configuration.cc
View file @
b2cf6d77
...
@@ -196,6 +196,7 @@ namespace UniSetTypes
...
@@ -196,6 +196,7 @@ namespace UniSetTypes
xmlNodesSec
=
0
;
xmlNodesSec
=
0
;
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
char
curdir
[
FILENAME_MAX
];
char
curdir
[
FILENAME_MAX
];
if
(
getcwd
(
curdir
,
FILENAME_MAX
)
==
NULL
)
if
(
getcwd
(
curdir
,
FILENAME_MAX
)
==
NULL
)
rootDir
=
""
;
rootDir
=
""
;
else
else
...
...
src/Various/LT_Object.cc
View file @
b2cf6d77
...
@@ -130,7 +130,8 @@ timeout_t LT_Object::getTimeInterval( TimerId timerid )
...
@@ -130,7 +130,8 @@ timeout_t LT_Object::getTimeInterval( TimerId timerid )
{
{
// lock
// lock
uniset_rwmutex_rlock
lock
(
lstMutex
);
uniset_rwmutex_rlock
lock
(
lstMutex
);
for
(
const
auto
&
li
:
tlst
)
for
(
const
auto
&
li
:
tlst
)
{
{
if
(
li
.
id
==
timerid
)
if
(
li
.
id
==
timerid
)
return
li
.
tmr
.
getInterval
();
return
li
.
tmr
.
getInterval
();
...
@@ -143,7 +144,8 @@ timeout_t LT_Object::getTimeLeft(TimerId timerid)
...
@@ -143,7 +144,8 @@ timeout_t LT_Object::getTimeLeft(TimerId timerid)
{
{
// lock
// lock
uniset_rwmutex_rlock
lock
(
lstMutex
);
uniset_rwmutex_rlock
lock
(
lstMutex
);
for
(
const
auto
&
li
:
tlst
)
for
(
const
auto
&
li
:
tlst
)
{
{
if
(
li
.
id
==
timerid
)
if
(
li
.
id
==
timerid
)
return
li
.
curTimeMS
;
return
li
.
curTimeMS
;
...
...
src/Various/RunLock.cc
View file @
b2cf6d77
...
@@ -48,6 +48,7 @@ bool RunLock::isLocked( const string& name )
...
@@ -48,6 +48,7 @@ bool RunLock::isLocked( const string& name )
char
ptr
[
10
];
char
ptr
[
10
];
int
n
=
fscanf
(
out
,
"%9s"
,
ptr
);
int
n
=
fscanf
(
out
,
"%9s"
,
ptr
);
if
(
n
<
1
)
if
(
n
<
1
)
{
{
fclose
(
out
);
fclose
(
out
);
...
...
src/Various/SMonitor.cc
View file @
b2cf6d77
...
@@ -117,8 +117,9 @@ void SMonitor::sensorInfo( const SensorMessage* si )
...
@@ -117,8 +117,9 @@ void SMonitor::sensorInfo( const SensorMessage* si )
int
ret
=
system
(
cmd
.
str
().
c_str
());
int
ret
=
system
(
cmd
.
str
().
c_str
());
int
res
=
WEXITSTATUS
(
ret
);
int
res
=
WEXITSTATUS
(
ret
);
if
(
res
!=
0
)
if
(
res
!=
0
)
cerr
<<
"run script '"
<<
cmd
.
str
()
<<
"' failed.."
<<
endl
;
cerr
<<
"run script '"
<<
cmd
.
str
()
<<
"' failed.."
<<
endl
;
// if( WIFSIGNALED(ret) && (WTERMSIG(ret) == SIGINT || WTERMSIG(ret) == SIGQUIT))
// if( WIFSIGNALED(ret) && (WTERMSIG(ret) == SIGINT || WTERMSIG(ret) == SIGQUIT))
// {
// {
...
...
src/Various/VMonitor.cc
View file @
b2cf6d77
...
@@ -70,13 +70,13 @@
...
@@ -70,13 +70,13 @@
#define VMON_MAKE_PAIR(vlist, T) \
#define VMON_MAKE_PAIR(vlist, T) \
{\
{\
for( const auto& e: m_##T ) \
for( const auto& e: m_##T ) \
vlist.push_back( std::make_pair(e.second, std::to_string(*(e.first))) );\
vlist.push_back( std::make_pair(e.second, std::to_string(*(e.first))) );\
}
}
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
#define VMON_MAKE_PAIR_S(vlist, T) \
#define VMON_MAKE_PAIR_S(vlist, T) \
{\
{\
for( const auto& e: m_##T ) \
for( const auto& e: m_##T ) \
vlist.push_back( std::make_pair(e.second,*e.first) );\
vlist.push_back( std::make_pair(e.second,*e.first) );\
}
}
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
#define VMON_MAKE_PAIR2(vlist, T) \
#define VMON_MAKE_PAIR2(vlist, T) \
...
@@ -113,9 +113,12 @@ std::ostream& operator<<( std::ostream& os, VMonitor& m )
...
@@ -113,9 +113,12 @@ std::ostream& operator<<( std::ostream& os, VMonitor& m )
{
{
auto
vlist
=
m
.
getList
();
auto
vlist
=
m
.
getList
();
// сортируем по алфавиту
// сортируем по алфавиту
vlist
.
sort
(
[](
const
std
::
pair
<
std
::
string
,
std
::
string
>
&
a
,
const
std
::
pair
<
std
::
string
,
std
::
string
>
&
b
)
{
return
a
.
first
<
b
.
first
;
});
vlist
.
sort
(
[](
const
std
::
pair
<
std
::
string
,
std
::
string
>&
a
,
const
std
::
pair
<
std
::
string
,
std
::
string
>&
b
)
{
return
a
.
first
<
b
.
first
;
});
for
(
const
auto
&
e
:
vlist
)
for
(
const
auto
&
e
:
vlist
)
os
<<
e
.
first
<<
" = "
<<
e
.
second
;
os
<<
e
.
first
<<
" = "
<<
e
.
second
;
return
os
;
return
os
;
...
@@ -130,15 +133,15 @@ std::string VMonitor::str()
...
@@ -130,15 +133,15 @@ std::string VMonitor::str()
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
std
::
list
<
std
::
pair
<
std
::
string
,
std
::
string
>
>
VMonitor
::
getList
()
std
::
list
<
std
::
pair
<
std
::
string
,
std
::
string
>
>
VMonitor
::
getList
()
{
{
std
::
list
<
std
::
pair
<
std
::
string
,
std
::
string
>>
vlist
;
std
::
list
<
std
::
pair
<
std
::
string
,
std
::
string
>>
vlist
;
VMON_MAKE_PAIR2
(
vlist
,
int
);
VMON_MAKE_PAIR2
(
vlist
,
int
);
VMON_MAKE_PAIR2
(
vlist
,
long
);
VMON_MAKE_PAIR2
(
vlist
,
long
);
VMON_MAKE_PAIR2
(
vlist
,
short
);
VMON_MAKE_PAIR2
(
vlist
,
short
);
VMON_MAKE_PAIR_CHAR
(
vlist
);
VMON_MAKE_PAIR_CHAR
(
vlist
);
VMON_MAKE_PAIR
(
vlist
,
bool
);
VMON_MAKE_PAIR
(
vlist
,
bool
);
VMON_MAKE_PAIR
(
vlist
,
float
);
VMON_MAKE_PAIR
(
vlist
,
float
);
VMON_MAKE_PAIR
(
vlist
,
double
);
VMON_MAKE_PAIR
(
vlist
,
double
);
VMON_MAKE_PAIR_S
(
vlist
,
string
);
VMON_MAKE_PAIR_S
(
vlist
,
string
);
return
std
::
move
(
vlist
);
return
std
::
move
(
vlist
);
}
}
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
...
@@ -148,13 +151,18 @@ std::string VMonitor::pretty_str( int namewidth, int colnum )
...
@@ -148,13 +151,18 @@ std::string VMonitor::pretty_str( int namewidth, int colnum )
std
::
ostringstream
os
;
std
::
ostringstream
os
;
// сортируем по алфавиту
// сортируем по алфавиту
vlist
.
sort
(
[](
const
std
::
pair
<
std
::
string
,
std
::
string
>
&
a
,
const
std
::
pair
<
std
::
string
,
std
::
string
>
&
b
)
{
return
a
.
first
<
b
.
first
;
});
vlist
.
sort
(
[](
const
std
::
pair
<
std
::
string
,
std
::
string
>&
a
,
const
std
::
pair
<
std
::
string
,
std
::
string
>&
b
)
{
return
a
.
first
<
b
.
first
;
});
int
n
=
0
;
int
n
=
0
;
for
(
const
auto
&
e
:
vlist
)
for
(
const
auto
&
e
:
vlist
)
{
{
os
<<
std
::
right
<<
std
::
setw
(
namewidth
)
<<
e
.
first
<<
std
::
left
<<
" = "
<<
std
::
right
<<
std
::
setw
(
10
)
<<
e
.
second
;
os
<<
std
::
right
<<
std
::
setw
(
namewidth
)
<<
e
.
first
<<
std
::
left
<<
" = "
<<
std
::
right
<<
std
::
setw
(
10
)
<<
e
.
second
;
if
(
(
n
++
)
%
colnum
)
if
(
(
n
++
)
%
colnum
)
os
<<
std
::
endl
;
os
<<
std
::
endl
;
}
}
...
...
src/Various/WDTInterface.cc
View file @
b2cf6d77
...
@@ -32,6 +32,7 @@ bool WDTInterface::ping()
...
@@ -32,6 +32,7 @@ bool WDTInterface::ping()
}
}
int
ret
=
write
(
fd
,
(
void
*
)
CMD_PING
,
sizeof
(
CMD_PING
));
int
ret
=
write
(
fd
,
(
void
*
)
CMD_PING
,
sizeof
(
CMD_PING
));
if
(
ret
==
-
1
)
if
(
ret
==
-
1
)
{
{
cerr
<<
": Unable to open device "
<<
dev
<<
" with err: "
<<
strerror
(
errno
)
<<
endl
;
cerr
<<
": Unable to open device "
<<
dev
<<
" with err: "
<<
strerror
(
errno
)
<<
endl
;
...
@@ -54,6 +55,7 @@ bool WDTInterface::stop()
...
@@ -54,6 +55,7 @@ bool WDTInterface::stop()
}
}
int
ret
=
write
(
fd
,
(
void
*
)
CMD_STOP
,
sizeof
(
CMD_STOP
));
int
ret
=
write
(
fd
,
(
void
*
)
CMD_STOP
,
sizeof
(
CMD_STOP
));
if
(
ret
==
-
1
)
if
(
ret
==
-
1
)
{
{
cerr
<<
": Unable to open device "
<<
dev
<<
" with err: "
<<
strerror
(
errno
)
<<
endl
;
cerr
<<
": Unable to open device "
<<
dev
<<
" with err: "
<<
strerror
(
errno
)
<<
endl
;
...
...
tests/test_pulse.cc
View file @
b2cf6d77
...
@@ -10,7 +10,7 @@ TEST_CASE("Pulse", "[Test for class 'Pulse' - impulse generator]" )
...
@@ -10,7 +10,7 @@ TEST_CASE("Pulse", "[Test for class 'Pulse' - impulse generator]" )
{
{
// Работа без задержки..(нулевые задержки)
// Работа без задержки..(нулевые задержки)
Pulse
p
;
Pulse
p
;
REQUIRE
(
p
.
getT1
()
==
0
);
REQUIRE
(
p
.
getT1
()
==
0
);
REQUIRE
(
p
.
getT0
()
==
0
);
REQUIRE
(
p
.
getT0
()
==
0
);
...
...
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