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
2b0f1aaa
Commit
2b0f1aaa
authored
Oct 30, 2014
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(IOBase): немного переделал инициализацию свойств в Modbus[Slave,Master].
Добавил в ModbusSlave параметр rawdata="1" (длс игнорирования свойств калибровки).
parent
a2b5974b
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
33 deletions
+26
-33
MBExchange.cc
extensions/ModbusMaster/MBExchange.cc
+1
-14
MBSlave.cc
extensions/ModbusSlave/MBSlave.cc
+18
-17
IOBase.h
extensions/include/IOBase.h
+5
-0
IOBase.cc
extensions/lib/IOBase.cc
+2
-2
No files found.
extensions/ModbusMaster/MBExchange.cc
View file @
2b0f1aaa
...
...
@@ -1909,7 +1909,7 @@ MBExchange::RSProperty* MBExchange::addProp( PList& plist, RSProperty& p )
// ------------------------------------------------------------------------------------------
bool
MBExchange
::
initRSProperty
(
RSProperty
&
p
,
UniXML_iterator
&
it
)
{
if
(
!
IOBase
::
initItem
(
&
p
,
it
,
shm
,
prefix
,
false
,
&
dlog
,
myname
)
)
if
(
!
IOBase
::
initItem
(
&
p
,
it
,
shm
,
pr
op_pr
efix
,
false
,
&
dlog
,
myname
)
)
return
false
;
// проверяем не пороговый ли это датчик (т.е. не связанный с обменом)
...
...
@@ -1931,19 +1931,6 @@ bool MBExchange::initRSProperty( RSProperty& p, UniXML_iterator& it )
p
.
cdiagram
=
0
;
}
string
stype
(
it
.
getProp
(
prop_prefix
+
"iotype"
)
);
if
(
!
stype
.
empty
()
)
{
p
.
stype
=
UniSetTypes
::
getIOType
(
stype
);
if
(
p
.
stype
==
UniversalIO
::
UnknownIOType
)
{
if
(
dlog
)
dlog
[
Debug
::
CRIT
]
<<
myname
<<
"(IOBase::readItem): неизвестный iotype=: "
<<
stype
<<
" for "
<<
it
.
getProp
(
"name"
)
<<
endl
;
return
false
;
}
}
string
sbit
(
it
.
getProp
(
prop_prefix
+
"nbit"
));
if
(
!
sbit
.
empty
()
)
{
...
...
extensions/ModbusSlave/MBSlave.cc
View file @
2b0f1aaa
...
...
@@ -818,42 +818,43 @@ bool MBSlave::initItem( UniXML_iterator& it )
{
IOProperty
p
;
if
(
!
IOBase
::
initItem
(
static_cast
<
IOBase
*>
(
&
p
),
it
,
shm
,
prefix
,
false
,
&
dlog
,
myname
)
)
string
prop_prefix
(
prefix
+
"_"
);
if
(
!
IOBase
::
initItem
(
static_cast
<
IOBase
*>
(
&
p
),
it
,
shm
,
prop_prefix
,
false
,
&
dlog
,
myname
)
)
return
false
;
if
(
it
.
getIntProp
(
prop_prefix
+
"rawdata"
)
)
{
p
.
cal
.
minRaw
=
0
;
p
.
cal
.
maxRaw
=
0
;
p
.
cal
.
minCal
=
0
;
p
.
cal
.
maxCal
=
0
;
p
.
cal
.
precision
=
0
;
p
.
cdiagram
=
0
;
}
if
(
mbregFromID
)
p
.
mbreg
=
p
.
si
.
id
;
else
{
string
r
=
it
.
getProp
(
"mbreg"
);
string
r
=
IOBase
::
initProp
(
it
,
"mbreg"
,
prop_prefix
,
false
);
if
(
r
.
empty
()
)
{
dlog
[
Debug
::
CRIT
]
<<
myname
<<
"(initItem): Unknown 'mbreg' for "
<<
it
.
getProp
(
"name"
)
<<
endl
;
dlog
[
Debug
::
CRIT
]
<<
myname
<<
"(initItem): Unknown 'mbreg' for "
<<
IOBase
::
initProp
(
it
,
"name"
,
prop_prefix
,
false
)
<<
endl
;
return
false
;
}
p
.
mbreg
=
ModbusRTU
::
str2mbData
(
r
);
}
string
stype
(
it
.
getProp
(
"mb_iotype"
)
);
if
(
stype
.
empty
()
)
stype
=
it
.
getProp
(
"iotype"
);
p
.
stype
=
UniSetTypes
::
getIOType
(
stype
);
if
(
p
.
stype
==
UniversalIO
::
UnknownIOType
)
{
dlog
[
Debug
::
CRIT
]
<<
myname
<<
"(initItem): Unknown 'iotype' or 'mb_iotype' for "
<<
it
.
getProp
(
"name"
)
<<
endl
;
return
false
;
}
p
.
amode
=
MBSlave
::
amRW
;
string
am
(
it
.
getProp
(
"mb_accessmode"
));
string
am
(
IOBase
::
initProp
(
it
,
"mb_accessmode"
,
prop_prefix
,
false
));
if
(
am
==
"ro"
)
p
.
amode
=
MBSlave
::
amRO
;
else
if
(
am
==
"rw"
)
p
.
amode
=
MBSlave
::
amRW
;
string
vt
(
it
.
getProp
(
"mb_vtype"
));
string
vt
(
IOBase
::
initProp
(
it
,
"mb_vtype"
,
prop_prefix
,
false
));
if
(
vt
.
empty
()
)
{
p
.
vtype
=
VTypes
::
vtUnknown
;
...
...
@@ -869,7 +870,7 @@ bool MBSlave::initItem( UniXML_iterator& it )
if
(
v
==
VTypes
::
vtUnknown
)
{
dlog
[
Debug
::
CRIT
]
<<
myname
<<
"(initItem): Unknown rtuVType="
<<
vt
<<
" for "
<<
it
.
getProp
(
"name"
)
<<
IOBase
::
initProp
(
it
,
"name"
,
prop_prefix
,
false
)
<<
endl
;
return
false
;
...
...
extensions/include/IOBase.h
View file @
2b0f1aaa
...
...
@@ -127,6 +127,11 @@ static const int NoSafety = -1;
float
def_lsparam
=
0
.
2
,
float
def_iir_coeff_prev
=
0
.
5
,
float
def_iir_coeff_new
=
0
.
5
);
// helpers
static
std
::
string
initProp
(
UniXML_iterator
&
it
,
const
std
::
string
&
prop
,
const
std
::
string
&
prefix
,
bool
prefonly
,
const
std
::
string
&
defval
=
""
);
static
int
initIntProp
(
UniXML_iterator
&
it
,
const
std
::
string
&
prop
,
const
std
::
string
&
prefix
,
bool
prefonly
,
const
int
defval
=
0
);
};
...
...
extensions/lib/IOBase.cc
View file @
2b0f1aaa
...
...
@@ -431,7 +431,7 @@ void IOBase::processingThreshold( IOBase* it, SMInterface* shm, bool force )
processingAsDI
(
it
,
set
,
shm
,
force
);
}
// -----------------------------------------------------------------------------
st
atic
std
::
string
initProp
(
UniXML_iterator
&
it
,
const
std
::
string
&
prop
,
const
std
::
string
&
prefix
,
bool
prefonly
,
const
std
::
string
&
defval
=
""
)
st
d
::
string
IOBase
::
initProp
(
UniXML_iterator
&
it
,
const
std
::
string
&
prop
,
const
std
::
string
&
prefix
,
bool
prefonly
,
const
std
::
string
&
defval
)
{
if
(
!
it
.
getProp
(
prefix
+
prop
).
empty
()
)
return
it
.
getProp
(
prefix
+
prop
);
...
...
@@ -445,7 +445,7 @@ static std::string initProp( UniXML_iterator& it, const std::string& prop, const
return
defval
;
}
static
int
initIntProp
(
UniXML_iterator
&
it
,
const
std
::
string
&
prop
,
const
std
::
string
&
prefix
,
bool
prefonly
,
const
int
defval
=
0
)
int
IOBase
::
initIntProp
(
UniXML_iterator
&
it
,
const
std
::
string
&
prop
,
const
std
::
string
&
prefix
,
bool
prefonly
,
const
int
defval
)
{
string
pp
(
prefix
+
prop
);
...
...
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