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
148f9e26
Commit
148f9e26
authored
Feb 02, 2015
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Исправил ошибку с вылетом в uniset2-smonit, а так же небольшие правки.
parent
cff1c7df
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
44 additions
and
31 deletions
+44
-31
main.cc
Utilities/NullController/main.cc
+3
-3
smonitor.cc
Utilities/SMonit/smonitor.cc
+9
-5
start_fg.sh
Utilities/SMonit/start_fg.sh
+1
-1
libuniset2.spec
conf/libuniset2.spec
+5
-1
MBExchange.cc
extensions/ModbusMaster/MBExchange.cc
+8
-8
DebugStream.h
include/DebugStream.h
+5
-0
ModbusClient.h
include/modbus/ModbusClient.h
+1
-1
UModbus.cc
python/lib/pyUniSet/UModbus.cc
+6
-6
ComPort485F.cc
src/Communications/ComPort485F.cc
+1
-1
ModbusClient.cc
src/Communications/Modbus/ModbusClient.cc
+1
-1
ModbusTCPCore.cc
src/Communications/Modbus/ModbusTCPCore.cc
+1
-1
LogSession.cc
src/Log/LogSession.cc
+3
-3
No files found.
Utilities/NullController/main.cc
View file @
148f9e26
...
...
@@ -71,9 +71,9 @@ int main(int argc, char** argv)
// надо ли писать изменения в БД
bool
dbDumping
=
conf
->
getArgInt
(
"--dbDumping"
);
NullController
nc
(
ID
,
askfile
,
s_field
,
s_fvalue
,
c_field
,
c_fvalue
,
dbDumping
);
UniSetActivatorPtr
act
=
UniSetActivator
::
Instance
();
act
->
add
(
nc
.
get_ptr
()
);
auto
nc
=
make_shared
<
NullController
>
(
ID
,
askfile
,
s_field
,
s_fvalue
,
c_field
,
c_fvalue
,
dbDumping
);
auto
act
=
UniSetActivator
::
Instance
();
act
->
add
(
nc
);
act
->
run
(
false
);
return
0
;
}
...
...
Utilities/SMonit/smonitor.cc
View file @
148f9e26
...
...
@@ -34,22 +34,26 @@ int main( int argc, const char **argv )
return
0
;
}
UniSetActivatorPtr
act
=
UniSetActivator
::
Instance
();
SMonitor
tp
(
ID
);
act
->
add
(
tp
.
get_ptr
()
);
auto
act
=
UniSetActivator
::
Instance
();
auto
smon
=
make_shared
<
SMonitor
>
(
ID
);
act
->
add
(
smon
);
SystemMessage
sm
(
SystemMessage
::
StartUp
);
act
->
broadcast
(
sm
.
transport_msg
()
);
act
->
run
(
false
);
return
0
;
}
catch
(
Exception
&
ex
)
catch
(
const
Exception
&
ex
)
{
cout
<<
"(main):"
<<
ex
<<
endl
;
}
catch
(
const
std
::
exception
&
ex
)
{
cout
<<
"(main): exception: "
<<
ex
.
what
()
<<
endl
;
}
catch
(...)
{
cout
<<
"(main):
Неизвестное исключение!!
!!"
<<
endl
;
cout
<<
"(main):
Unknown exception
!!"
<<
endl
;
}
return
1
;
...
...
Utilities/SMonit/start_fg.sh
View file @
148f9e26
#!/bin/sh
uniset2-start.sh
-
f
./uniset2-smonit
--name
TestProc
--confile
test.xml
--sid
$*
uniset2-start.sh
-
g
./uniset2-smonit
--name
TestProc
--confile
test.xml
--sid
$*
#--ulog-add-levels system,info,level9 $*
conf/libuniset2.spec
View file @
148f9e26
...
...
@@ -12,7 +12,7 @@
Name: libuniset2
Version: 2.0
Release: alt1
4
Release: alt1
5
Summary: UniSet - library for building distributed industrial control systems
...
...
@@ -406,6 +406,10 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname
%exclude %_pkgconfigdir/libUniSet2.pc
%changelog
* Sun Feb 01 2015 Pavel Vainerman <pv@altlinux.ru> 2.0-alt15
- fixed minor bug in uniset2-smonit utility
- minor fixes
* Mon Jan 26 2015 Pavel Vainerman <pv@altlinux.ru> 2.0-alt14
- change LogServer,LogSession,LogReader interfaces
...
...
extensions/ModbusMaster/MBExchange.cc
View file @
148f9e26
...
...
@@ -875,7 +875,7 @@ bool MBExchange::pollRTU( RTUDevice* dev, RegMap::iterator& it )
for
(
auto
i
=
0
;
i
<
ret
.
bcnt
;
i
++
)
{
ModbusRTU
::
DataBits
b
(
ret
.
data
[
i
]);
for
(
auto
k
=
0
;
k
<
ModbusRTU
::
BitsPerByte
&&
m
<
p
->
q_count
;
k
++
,
it
++
,
m
++
)
for
(
unsigned
int
k
=
0
;
k
<
ModbusRTU
::
BitsPerByte
&&
m
<
p
->
q_count
;
k
++
,
it
++
,
m
++
)
it
->
second
->
mbval
=
b
[
k
];
}
it
--
;
...
...
@@ -889,7 +889,7 @@ bool MBExchange::pollRTU( RTUDevice* dev, RegMap::iterator& it )
for
(
auto
i
=
0
;
i
<
ret
.
bcnt
;
i
++
)
{
ModbusRTU
::
DataBits
b
(
ret
.
data
[
i
]);
for
(
auto
k
=
0
;
k
<
ModbusRTU
::
BitsPerByte
&&
m
<
p
->
q_count
;
k
++
,
it
++
,
m
++
)
for
(
unsigned
int
k
=
0
;
k
<
ModbusRTU
::
BitsPerByte
&&
m
<
p
->
q_count
;
k
++
,
it
++
,
m
++
)
it
->
second
->
mbval
=
b
[
k
]
?
1
:
0
;
}
it
--
;
...
...
@@ -974,7 +974,7 @@ bool MBExchange::pollRTU( RTUDevice* dev, RegMap::iterator& it )
}
ModbusRTU
::
ForceCoilsMessage
msg
(
dev
->
mbaddr
,
p
->
mbreg
);
for
(
auto
i
=
0
;
i
<
p
->
q_count
;
i
++
,
it
++
)
for
(
unsigned
i
=
0
;
i
<
p
->
q_count
;
i
++
,
it
++
)
msg
.
addBit
(
(
it
->
second
->
mbval
?
true
:
false
)
);
it
--
;
...
...
@@ -1298,7 +1298,7 @@ void MBExchange::updateRSProperty( RSProperty* p, bool write_only )
else
{
ModbusRTU
::
ModbusData
*
data
=
new
ModbusRTU
::
ModbusData
[
VTypes
::
F2
::
wsize
()];
for
(
unsigned
int
k
=
0
;
k
<
VTypes
::
F2
::
wsize
();
k
++
,
i
++
)
for
(
int
k
=
0
;
k
<
VTypes
::
F2
::
wsize
();
k
++
,
i
++
)
data
[
k
]
=
i
->
second
->
mbval
;
float
f
=
0
;
...
...
@@ -1327,14 +1327,14 @@ void MBExchange::updateRSProperty( RSProperty* p, bool write_only )
{
float
f
=
IOBase
::
processingFasAO
(
p
,
shm
,
force_out
);
VTypes
::
F4
f4
(
f
);
for
(
unsigned
int
k
=
0
;
k
<
VTypes
::
F4
::
wsize
();
k
++
,
i
++
)
for
(
int
k
=
0
;
k
<
VTypes
::
F4
::
wsize
();
k
++
,
i
++
)
i
->
second
->
mbval
=
f4
.
raw
.
v
[
k
];
}
}
else
{
ModbusRTU
::
ModbusData
*
data
=
new
ModbusRTU
::
ModbusData
[
VTypes
::
F4
::
wsize
()];
for
(
unsigned
int
k
=
0
;
k
<
VTypes
::
F4
::
wsize
();
k
++
,
i
++
)
for
(
int
k
=
0
;
k
<
VTypes
::
F4
::
wsize
();
k
++
,
i
++
)
data
[
k
]
=
i
->
second
->
mbval
;
VTypes
::
F4
f
(
data
,
VTypes
::
F4
::
wsize
());
...
...
@@ -1369,7 +1369,7 @@ void MBExchange::updateRSProperty( RSProperty* p, bool write_only )
else
{
ModbusRTU
::
ModbusData
*
data
=
new
ModbusRTU
::
ModbusData
[
VTypes
::
I2
::
wsize
()];
for
(
unsigned
int
k
=
0
;
k
<
VTypes
::
I2
::
wsize
();
k
++
,
i
++
)
for
(
int
k
=
0
;
k
<
VTypes
::
I2
::
wsize
();
k
++
,
i
++
)
data
[
k
]
=
i
->
second
->
mbval
;
int
v
=
0
;
...
...
@@ -1415,7 +1415,7 @@ void MBExchange::updateRSProperty( RSProperty* p, bool write_only )
else
{
ModbusRTU
::
ModbusData
*
data
=
new
ModbusRTU
::
ModbusData
[
VTypes
::
U2
::
wsize
()];
for
(
unsigned
int
k
=
0
;
k
<
VTypes
::
U2
::
wsize
();
k
++
,
i
++
)
for
(
int
k
=
0
;
k
<
VTypes
::
U2
::
wsize
();
k
++
,
i
++
)
data
[
k
]
=
i
->
second
->
mbval
;
unsigned
int
v
=
0
;
...
...
include/DebugStream.h
View file @
148f9e26
...
...
@@ -161,6 +161,11 @@ public:
inline
void
showLogType
(
bool
s
)
{
show_logtype
=
s
;
}
inline
std
::
ostream
&
log
(
Debug
::
type
l
)
{
return
this
->
operator
[](
l
);
}
// короткие функции (для удобства)
// log.level1() - вывод с датой и временем "date time [LEVEL] ...",
// если вывод даты и времени не выключен при помощи showDateTime(false)
...
...
include/modbus/ModbusClient.h
View file @
148f9e26
...
...
@@ -144,7 +144,7 @@ class ModbusClient
/*! установить паузу при ожидании символа */
inline
void
setSleepPause
(
timeout_t
usec
){
sleepPause_usec
=
usec
;
}
void
initLog
(
UniSetTypes
::
Configuration
*
conf
,
const
std
::
string
&
name
,
const
std
::
string
&
logfile
=
""
);
void
initLog
(
std
::
shared_ptr
<
UniSetTypes
::
Configuration
>
conf
,
const
std
::
string
&
name
,
const
std
::
string
&
logfile
=
""
);
void
setLog
(
std
::
shared_ptr
<
DebugStream
>
dlog
);
...
...
python/lib/pyUniSet/UModbus.cc
View file @
148f9e26
...
...
@@ -7,7 +7,7 @@ using namespace std;
#if 0
UModbus::UModbus( UTypes::Params* p )throw(UException):
mb(0),
port(5
1
2),
port(5
0
2),
ip(""),
tout_msec(5000)
{
...
...
@@ -22,10 +22,10 @@ UModbus::UModbus( UTypes::Params* p )throw(UException):
}
//---------------------------------------------------------------------------
UModbus::UModbus( int argc, char** argv )throw(UException):
mb(0),
ip(""
),
port(512
),
tout_msec(5000)
mb(0),
port(502
),
ip(""
),
tout_msec(5000)
{
try
{
...
...
@@ -40,8 +40,8 @@ tout_msec(5000)
// --------------------------------------------------------------------------
UModbus
::
UModbus
()
:
mb
(
0
),
port
(
502
),
ip
(
""
),
port
(
512
),
tout_msec
(
5000
)
{
mb
=
new
ModbusTCPMaster
();
...
...
src/Communications/ComPort485F.cc
View file @
148f9e26
...
...
@@ -220,7 +220,7 @@ void ComPort485F::sendByte( unsigned char x )
// --------------------------------------------------------------------------------
void
ComPort485F
::
save2queue
(
unsigned
char
*
msg
,
int
len
,
int
bnum
)
{
for
(
unsigned
int
i
=
0
;
i
<
len
&&
i
<
bnum
;
i
++
)
for
(
auto
i
=
0
;
i
<
len
&&
i
<
bnum
;
i
++
)
{
wq
.
push
(
msg
[
i
]);
// fprintf(stderr,"save 2 squeue: %x\n",msg[i]);
...
...
src/Communications/Modbus/ModbusClient.cc
View file @
148f9e26
...
...
@@ -1258,7 +1258,7 @@ mbErrCode ModbusClient::send( ModbusMessage& msg )
}
// -------------------------------------------------------------------------
void
ModbusClient
::
initLog
(
UniSetTypes
::
Configuration
*
conf
,
void
ModbusClient
::
initLog
(
std
::
shared_ptr
<
UniSetTypes
::
Configuration
>
conf
,
const
std
::
string
&
lname
,
const
string
&
logfile
)
{
conf
->
initLogStream
(
dlog
,
lname
);
...
...
src/Communications/Modbus/ModbusTCPCore.cc
View file @
148f9e26
...
...
@@ -58,7 +58,7 @@ mbErrCode ModbusTCPCore::sendData( ost::TCPStream* tcp, unsigned char* buf, int
try
{
for
(
unsigned
int
i
=
0
;
i
<
len
;
i
++
)
for
(
auto
i
=
0
;
i
<
len
;
i
++
)
(
*
tcp
)
<<
buf
[
i
];
return
erNoError
;
...
...
src/Log/LogSession.cc
View file @
148f9e26
...
...
@@ -33,13 +33,13 @@ TCPSession(server)
// -------------------------------------------------------------------------
LogSession
::
LogSession
(
ost
::
TCPSocket
&
server
,
std
::
shared_ptr
<
DebugStream
>&
_log
,
timeout_t
_sessTimeout
,
timeout_t
_cmdTimeout
,
timeout_t
_outTimeout
,
timeout_t
_delay
)
:
TCPSession
(
server
),
peername
(
""
),
caddr
(
""
),
log
(
_log
),
sessTimeout
(
_sessTimeout
),
cmdTimeout
(
_cmdTimeout
),
outTimeout
(
_outTimeout
),
delayTime
(
_delay
),
peername
(
""
),
caddr
(
""
),
log
(
_log
),
cancelled
(
false
)
{
log_notify
=
ATOMIC_VAR_INIT
(
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