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
Show whitespace changes
Inline
Side-by-side
Showing
62 changed files
with
322 additions
and
194 deletions
+322
-194
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
+0
-0
iocalibr.cc
extensions/IOControl/iocalibr.cc
+3
-0
iotest.cc
extensions/IOControl/iotest.cc
+1
-0
PassiveLProcessor.h
extensions/LogicProcessor/PassiveLProcessor.h
+0
-0
MBExchange.cc
extensions/ModbusMaster/MBExchange.cc
+21
-15
MBTCPMaster.cc
extensions/ModbusMaster/MBTCPMaster.cc
+0
-0
MBTCPMultiMaster.cc
extensions/ModbusMaster/MBTCPMultiMaster.cc
+6
-5
RTUExchange.cc
extensions/ModbusMaster/RTUExchange.cc
+3
-3
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
+21
-9
MBSlave.h
extensions/ModbusSlave/MBSlave.h
+1
-1
RRDServer.cc
extensions/RRDServer/RRDServer.cc
+1
-0
SharedMemory.h
extensions/SharedMemory/SharedMemory.h
+0
-0
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
+0
-0
MTR.h
extensions/include/MTR.h
+1
-1
UObject_SK.h
extensions/include/UObject_SK.h
+74
-56
IOBase.cc
extensions/lib/IOBase.cc
+1
-1
MTR.cc
extensions/lib/MTR.cc
+0
-0
UObject_SK.cc
extensions/lib/UObject_SK.cc
+78
-61
LT_Object.h
include/LT_Object.h
+0
-0
Trigger.h
include/Trigger.h
+4
-1
UniSetManager.h
include/UniSetManager.h
+0
-0
UniSetObject.h
include/UniSetObject.h
+3
-3
UModbus.cc
python/lib/pyUniSet/UModbus.cc
+0
-0
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
+0
-0
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
+21
-13
WDTInterface.cc
src/Various/WDTInterface.cc
+2
-0
test_pulse.cc
tests/test_pulse.cc
+0
-0
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
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
extensions/ModbusMaster/MBExchange.cc
View file @
b2cf6d77
...
@@ -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::exception_ptr p = std::current_exception();
// std::clog <<(p ? p.__cxa_exception_type()->name() : "null") << std::endl;
// 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
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;
// }
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
...
...
extensions/ModbusMaster/RTUExchange.cc
View file @
b2cf6d77
...
@@ -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
...
@@ -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
);
}
}
...
@@ -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
);
}
}
...
@@ -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
...
@@ -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
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
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
...
@@ -29,7 +29,7 @@ class UObject_SK:
...
@@ -29,7 +29,7 @@ class UObject_SK:
public
UniSetObject
public
UniSetObject
{
{
public
:
public
:
UObject_SK
(
UniSetTypes
::
ObjectId
id
,
xmlNode
*
node
=
UniSetTypes
::
uniset_conf
()
->
getNode
(
"UObject"
),
const
std
::
string
&
argprefix
=
""
);
UObject_SK
(
UniSetTypes
::
ObjectId
id
,
xmlNode
*
node
=
UniSetTypes
::
uniset_conf
()
->
getNode
(
"UObject"
),
const
std
::
string
&
argprefix
=
""
);
UObject_SK
();
UObject_SK
();
virtual
~
UObject_SK
();
virtual
~
UObject_SK
();
...
@@ -43,54 +43,60 @@ class UObject_SK:
...
@@ -43,54 +43,60 @@ class UObject_SK:
virtual
bool
setMsg
(
UniSetTypes
::
ObjectId
code
,
bool
state
=
true
);
virtual
bool
setMsg
(
UniSetTypes
::
ObjectId
code
,
bool
state
=
true
);
inline
std
::
shared_ptr
<
DebugStream
>
log
(){
return
mylog
;
}
inline
std
::
shared_ptr
<
DebugStream
>
log
()
inline
std
::
shared_ptr
<
LogAgregator
>
logAgregator
(){
return
loga
;
}
{
return
mylog
;
}
inline
std
::
shared_ptr
<
LogAgregator
>
logAgregator
()
{
return
loga
;
}
void
init_dlog
(
std
::
shared_ptr
<
DebugStream
>
d
);
void
init_dlog
(
std
::
shared_ptr
<
DebugStream
>
d
);
// "синтаксический сахар"..для логов
// "синтаксический сахар"..для логов
#ifndef myinfo
#ifndef myinfo
#define myinfo if( log()->debugging(Debug::INFO) ) log()->info()
#define myinfo if( log()->debugging(Debug::INFO) ) log()->info()
#endif
#endif
#ifndef mywarn
#ifndef mywarn
#define mywarn if( log()->debugging(Debug::WARN) ) log()->warn()
#define mywarn if( log()->debugging(Debug::WARN) ) log()->warn()
#endif
#endif
#ifndef mycrit
#ifndef mycrit
#define mycrit if( log()->debugging(Debug::CRIT) ) log()->crit()
#define mycrit if( log()->debugging(Debug::CRIT) ) log()->crit()
#endif
#endif
#ifndef mylog1
#ifndef mylog1
#define mylog1 if( log()->debugging(Debug::LEVEL1) ) log()->level1()
#define mylog1 if( log()->debugging(Debug::LEVEL1) ) log()->level1()
#endif
#endif
#ifndef mylog2
#ifndef mylog2
#define mylog2 if( log()->debugging(Debug::LEVEL2) ) log()->level2()
#define mylog2 if( log()->debugging(Debug::LEVEL2) ) log()->level2()
#endif
#endif
#ifndef mylog3
#ifndef mylog3
#define mylog3 if( log()->debugging(Debug::LEVEL3) ) log()->level3()
#define mylog3 if( log()->debugging(Debug::LEVEL3) ) log()->level3()
#endif
#endif
#ifndef mylog4
#ifndef mylog4
#define mylog4 if( log()->debugging(Debug::LEVEL4) ) log()->level4()
#define mylog4 if( log()->debugging(Debug::LEVEL4) ) log()->level4()
#endif
#endif
#ifndef mylog5
#ifndef mylog5
#define mylog5 if( log()->debugging(Debug::LEVEL5) ) log()->level5()
#define mylog5 if( log()->debugging(Debug::LEVEL5) ) log()->level5()
#endif
#endif
#ifndef mylog6
#ifndef mylog6
#define mylog6 if( log()->debugging(Debug::LEVEL6) ) log()->level6()
#define mylog6 if( log()->debugging(Debug::LEVEL6) ) log()->level6()
#endif
#endif
#ifndef mylog7
#ifndef mylog7
#define mylog7 if( log()->debugging(Debug::LEVEL7) ) log()->level7()
#define mylog7 if( log()->debugging(Debug::LEVEL7) ) log()->level7()
#endif
#endif
#ifndef mylog8
#ifndef mylog8
#define mylog8 if( log()->debugging(Debug::LEVEL8) ) log()->level8()
#define mylog8 if( log()->debugging(Debug::LEVEL8) ) log()->level8()
#endif
#endif
#ifndef mylog9
#ifndef mylog9
#define mylog9 if( log()->debugging(Debug::LEVEL9) ) log()->level9()
#define mylog9 if( log()->debugging(Debug::LEVEL9) ) log()->level9()
#endif
#endif
#ifndef mylogany
#ifndef mylogany
#define mylogany log()->any()
#define mylogany log()->any()
#endif
#endif
#ifndef vmonit
#ifndef vmonit
#define vmonit( var ) vmon.add( #var, var )
#define vmonit( var ) vmon.add( #var, var )
#endif
#endif
// Вспомогательные функции для удобства логирования
// Вспомогательные функции для удобства логирования
// ------------------------------------------------------------
// ------------------------------------------------------------
...
@@ -107,16 +113,19 @@ class UObject_SK:
...
@@ -107,16 +113,19 @@ class UObject_SK:
\param id - идентификатор датчика
\param id - идентификатор датчика
\param showLinkName - TRUE - выводить SensorName, FALSE - не выводить
\param showLinkName - TRUE - выводить SensorName, FALSE - не выводить
*/
*/
std
::
string
str
(
UniSetTypes
::
ObjectId
id
,
bool
showLinkName
=
true
);
std
::
string
str
(
UniSetTypes
::
ObjectId
id
,
bool
showLinkName
=
true
);
/*! Вывод значения входа/выхода в формате: in_xxx(SensorName)=val
/*! Вывод значения входа/выхода в формате: in_xxx(SensorName)=val
\param id - идентификатор датчика
\param id - идентификатор датчика
\param showLinkName - TRUE - выводить SensorName, FALSE - не выводить
\param showLinkName - TRUE - выводить SensorName, FALSE - не выводить
*/
*/
std
::
string
strval
(
UniSetTypes
::
ObjectId
id
,
bool
showLinkName
=
true
);
std
::
string
strval
(
UniSetTypes
::
ObjectId
id
,
bool
showLinkName
=
true
);
/*! Вывод состояния внутренних переменных */
/*! Вывод состояния внутренних переменных */
inline
std
::
string
dumpVars
(){
return
std
::
move
(
vmon
.
pretty_str
());
}
inline
std
::
string
dumpVars
()
{
return
std
::
move
(
vmon
.
pretty_str
());
}
// ------------------------------------------------------------
// ------------------------------------------------------------
std
::
string
help
();
std
::
string
help
();
...
@@ -145,13 +154,16 @@ class UObject_SK:
...
@@ -145,13 +154,16 @@ class UObject_SK:
virtual
void
callback
()
override
;
virtual
void
callback
()
override
;
virtual
void
processingMessage
(
UniSetTypes
::
VoidMessage
*
msg
)
override
;
virtual
void
processingMessage
(
UniSetTypes
::
VoidMessage
*
msg
)
override
;
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
)
override
{}
virtual
void
sensorInfo
(
const
UniSetTypes
::
SensorMessage
*
sm
)
override
{}
virtual
void
timerInfo
(
const
UniSetTypes
::
TimerMessage
*
tm
)
override
{}
virtual
void
timerInfo
(
const
UniSetTypes
::
TimerMessage
*
tm
)
override
{}
virtual
void
sigterm
(
int
signo
)
override
;
virtual
void
sigterm
(
int
signo
)
override
;
virtual
bool
activateObject
()
override
;
virtual
bool
activateObject
()
override
;
virtual
std
::
string
getMonitInfo
(){
return
""
;
}
/*!< пользовательская информация выводимая в getInfo() */
virtual
std
::
string
getMonitInfo
()
{
return
""
;
/*!< пользовательская информация выводимая в getInfo() */
}
virtual
void
testMode
(
bool
state
);
virtual
void
testMode
(
bool
state
);
void
updatePreviousValues
();
void
updatePreviousValues
();
...
@@ -171,7 +183,7 @@ class UObject_SK:
...
@@ -171,7 +183,7 @@ class UObject_SK:
int
resetMsgTime
;
int
resetMsgTime
;
// Выполнение очередного шага программы
// Выполнение очередного шага программы
virtual
void
step
(){}
virtual
void
step
()
{}
int
sleep_msec
;
/*!< пауза между итерациями */
int
sleep_msec
;
/*!< пауза между итерациями */
bool
active
;
bool
active
;
...
@@ -186,9 +198,15 @@ class UObject_SK:
...
@@ -186,9 +198,15 @@ class UObject_SK:
xmlNode
*
confnode
;
xmlNode
*
confnode
;
/*! получить числовое свойство из конф. файла по привязанной confnode */
/*! получить числовое свойство из конф. файла по привязанной confnode */
int
getIntProp
(
const
std
::
string
&
name
)
{
return
UniSetTypes
::
uniset_conf
()
->
getIntProp
(
confnode
,
name
);
}
int
getIntProp
(
const
std
::
string
&
name
)
{
return
UniSetTypes
::
uniset_conf
()
->
getIntProp
(
confnode
,
name
);
}
/*! получить текстовое свойство из конф. файла по привязанной confnode */
/*! получить текстовое свойство из конф. файла по привязанной confnode */
inline
const
std
::
string
getProp
(
const
std
::
string
&
name
)
{
return
UniSetTypes
::
uniset_conf
()
->
getProp
(
confnode
,
name
);
}
inline
const
std
::
string
getProp
(
const
std
::
string
&
name
)
{
return
UniSetTypes
::
uniset_conf
()
->
getProp
(
confnode
,
name
);
}
timeout_t
smReadyTimeout
;
/*!< время ожидания готовности SM */
timeout_t
smReadyTimeout
;
/*!< время ожидания готовности SM */
std
::
atomic_bool
activated
;
std
::
atomic_bool
activated
;
...
...
extensions/lib/IOBase.cc
View file @
b2cf6d77
...
@@ -579,7 +579,7 @@ bool IOBase::initItem( IOBase* b, UniXML::iterator& it, const std::shared_ptr<SM
...
@@ -579,7 +579,7 @@ 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
...
...
extensions/lib/MTR.cc
View file @
b2cf6d77
extensions/lib/UObject_SK.cc
View file @
b2cf6d77
This diff is collapsed.
Click to expand it.
include/LT_Object.h
View file @
b2cf6d77
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
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
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
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
...
@@ -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
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