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
a85d2886
Commit
a85d2886
authored
Aug 03, 2009
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleaning MBSlave
parent
1e4af3a1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
30 deletions
+4
-30
MBSlave.cc
extensions/ModbusSlave/MBSlave.cc
+1
-26
MBSlave.h
extensions/ModbusSlave/MBSlave.h
+2
-3
start_tcp_fg.sh
extensions/ModbusSlave/start_tcp_fg.sh
+1
-1
No files found.
extensions/ModbusSlave/MBSlave.cc
View file @
a85d2886
...
...
@@ -49,7 +49,7 @@ prefix(prefix)
dlog
[
Debug
::
INFO
]
<<
myname
<<
"(init): read s_field='"
<<
s_field
<<
"' s_fvalue='"
<<
s_fvalue
<<
"'"
<<
endl
;
force
=
atoi
(
conf
->
getArgParam
(
"--"
+
prefix
+
"-force"
,
it
.
getProp
(
"force"
)).
c_str
());
force
=
atoi
(
conf
->
getArgParam
(
"--"
+
prefix
+
"-force"
,
it
.
getProp
(
"force"
)).
c_str
());
int
recv_timeout
=
atoi
(
conf
->
getArgParam
(
"--"
+
prefix
+
"-recv-timeout"
,
it
.
getProp
(
"recv_timeout"
)).
c_str
());
...
...
@@ -687,25 +687,13 @@ bool MBSlave::initItem( UniXML_iterator& it )
stype
=
it
.
getProp
(
"iotype"
);
if
(
stype
==
"AI"
)
{
p
.
stype
=
UniversalIO
::
AnalogInput
;
p
.
mbfunc
=
ModbusRTU
::
fnReadInputRegisters
;
}
else
if
(
stype
==
"DI"
)
{
p
.
stype
=
UniversalIO
::
DigitalInput
;
p
.
mbfunc
=
ModbusRTU
::
fnReadInputRegisters
;
}
else
if
(
stype
==
"AO"
)
{
p
.
stype
=
UniversalIO
::
AnalogOutput
;
p
.
mbfunc
=
ModbusRTU
::
fnWriteOutputRegisters
;
}
else
if
(
stype
==
"DO"
)
{
p
.
stype
=
UniversalIO
::
DigitalOutput
;
p
.
mbfunc
=
ModbusRTU
::
fnWriteOutputRegisters
;
}
p
.
amode
=
MBSlave
::
amRW
;
string
am
(
it
.
getProp
(
"mb_accessmode"
));
...
...
@@ -714,19 +702,6 @@ bool MBSlave::initItem( UniXML_iterator& it )
else
if
(
am
==
"rw"
)
p
.
amode
=
MBSlave
::
amRW
;
string
f
=
it
.
getProp
(
"mbfunc"
);
if
(
!
f
.
empty
()
)
{
p
.
mbfunc
=
(
ModbusRTU
::
SlaveFunctionCode
)
UniSetTypes
::
uni_atoi
(
f
.
c_str
());
if
(
p
.
mbfunc
==
ModbusRTU
::
fnUnknown
)
{
dlog
[
Debug
::
CRIT
]
<<
myname
<<
"(initItem): mbfunc ='"
<<
f
<<
"' "
<<
it
.
getProp
(
"name"
)
<<
endl
;
return
false
;
}
}
iomap
[
p
.
mbreg
]
=
p
;
if
(
dlog
.
debugging
(
Debug
::
INFO
)
)
...
...
extensions/ModbusSlave/MBSlave.h
View file @
a85d2886
...
...
@@ -46,11 +46,10 @@ class MBSlave:
public
IOBase
{
ModbusRTU
::
ModbusData
mbreg
;
/*!< */
ModbusRTU
::
SlaveFunctionCode
mbfunc
;
/*!< / */
AccessMode
amode
;
IOProperty
()
:
mbreg
(
0
)
,
mbfunc
(
ModbusRTU
::
fnUnknown
)
IOProperty
()
:
mbreg
(
0
)
{}
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
IOProperty
&
p
);
...
...
extensions/ModbusSlave/start_tcp_fg.sh
View file @
a85d2886
#!/bin/sh
uniset-start.sh
-f
./uniset-mbslave
--mbs-name
MBSlave1
--confile
configure
.xml
--dlog-add-levels
info,crit,warn
\
uniset-start.sh
-f
./uniset-mbslave
--mbs-name
MBSlave1
--confile
test
.xml
--dlog-add-levels
info,crit,warn
\
--mbs-name
MBSlave1
\
--mbs-type
TCP
--mbs-inet-addr
127.0.0.1
--mbs-inet-port
2048
--mbs-reg-from-id
1
--mbs-my-addr
0x01
\
--mbs-askcount-id
SVU_AskCount_AS
...
...
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