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
f6886e88
Commit
f6886e88
authored
Mar 15, 2010
by
Ivan Donchevskiy
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into utf8
Conflicts: conf/libuniset.spec include/UniSetTypes.h
parents
9b195da5
b99551b4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
731 additions
and
8 deletions
+731
-8
libuniset.spec
conf/libuniset.spec
+12
-2
Makefile.am
extensions/RTUExchange/Makefile.am
+8
-4
mtr-setup.cc
extensions/RTUExchange/mtr-setup.cc
+391
-0
MTR.h
extensions/include/MTR.h
+21
-0
MTR.cc
extensions/lib/MTR.cc
+234
-0
Configuration.h
include/Configuration.h
+1
-0
IONotifyController.h
include/IONotifyController.h
+1
-0
UniSetTypes.h
include/UniSetTypes.h
+5
-0
UniversalInterface.h
include/UniversalInterface.h
+3
-0
UniversalInterface.cc
src/Interfaces/UniversalInterface.cc
+13
-0
ObjectIndex_XML.cc
src/ObjectRepository/ObjectIndex_XML.cc
+3
-0
ObjectIndex_idXML.cc
src/ObjectRepository/ObjectIndex_idXML.cc
+5
-0
IONotifyController.cc
src/Processes/IONotifyController.cc
+4
-0
Configuration.cc
src/Various/Configuration.cc
+9
-0
ui.cc
tests/ui.cc
+21
-2
No files found.
conf/libuniset.spec
View file @
f6886e88
...
...
@@ -3,7 +3,7 @@
Name: libuniset
Version: 0.97
Release: eter5
6
Release: eter5
9
Summary: UniSet - library for building distributed industrial control systems
License: GPL
Group: Development/C++
...
...
@@ -143,7 +143,8 @@ rm -f %buildroot%_libdir/*.la
%_bindir/%oname-iocalibr
%_bindir/%oname-logicproc
%_bindir/%oname-plogicproc
%_bindir/mtrconv
%_bindir/mtr-conv
%_bindir/mtr-setup
%_bindir/vtconv
%_bindir/rtustate
%_bindir/%oname-rtuexchange
...
...
@@ -184,6 +185,15 @@ rm -f %buildroot%_libdir/*.la
%changelog
* Sun Mar 14 2010 Pavel Vainerman <pv@altlinux.ru> 0.97-eter58
- minor fixes in MTR setup API
* Sun Mar 14 2010 Pavel Vainerman <pv@altlinux.ru> 0.97-eter57
- add MTR setup (API and utility)
* Sat Mar 13 2010 Pavel Vainerman <pv@altlinux.ru> 0.97-eter56
- new build
* Fri Mar 12 2010 Pavel Vainerman <pv@altlinux.ru> 0.97-eter55
- new build
...
...
extensions/RTUExchange/Makefile.am
View file @
f6886e88
bin_PROGRAMS
=
@PACKAGE@-rtuexchange mtr
conv rtustate vtconv
bin_PROGRAMS
=
@PACKAGE@-rtuexchange mtr
-conv rtustate vtconv mtr-setup
lib_LTLIBRARIES
=
libUniSetRTU.la
libUniSetRTU_la_LIBADD
=
$(top_builddir)
/lib/libUniSet.la
\
...
...
@@ -15,9 +15,13 @@ libUniSetRTU_la_SOURCES = RTUStorage.cc RTUExchange.cc
$(SIGC_LIBS)
@PACKAGE@
_rtuexchange_CXXFLAGS
=
-I
$(top_builddir)
/extensions/include
-I
$(top_builddir)
/extensions/SharedMemory
$(SIGC_CFLAGS)
mtrconv_SOURCES
=
mtrconv.cc
mtrconv_LDADD
=
$(top_builddir)
/extensions/lib/libUniSetExtensions.la
$(top_builddir)
/lib/libUniSet.la
mtrconv_CXXFLAGS
=
-I
$(top_builddir)
/extensions/include
mtr_conv_SOURCES
=
mtrconv.cc
mtr_conv_LDADD
=
$(top_builddir)
/extensions/lib/libUniSetExtensions.la
$(top_builddir)
/lib/libUniSet.la
mtr_conv_CXXFLAGS
=
-I
$(top_builddir)
/extensions/include
mtr_setup_SOURCES
=
mtr-setup.cc
mtr_setup_LDADD
=
$(top_builddir)
/extensions/lib/libUniSetExtensions.la
$(top_builddir)
/lib/libUniSet.la
mtr_setup_CXXFLAGS
=
-I
$(top_builddir)
/extensions/include
vtconv_SOURCES
=
vtconv.cc
vtconv_LDADD
=
$(top_builddir)
/extensions/lib/libUniSetExtensions.la
$(top_builddir)
/lib/libUniSet.la
...
...
extensions/RTUExchange/mtr-setup.cc
0 → 100644
View file @
f6886e88
This diff is collapsed.
Click to expand it.
extensions/include/MTR.h
View file @
f6886e88
...
...
@@ -5,9 +5,12 @@
#define _MTR_H_
// -----------------------------------------------------------------------------
#include <string>
#include <map>
#include <list>
#include <cstring>
#include <cmath>
#include "modbus/ModbusTypes.h"
#include "ComPort.h"
// -----------------------------------------------------------------------------
class
ModbusRTUMaster
;
// -----------------------------------------------------------------------------
...
...
@@ -79,7 +82,25 @@ namespace MTR
bool
setStopBit
(
ModbusRTUMaster
*
mb
,
ModbusRTU
::
ModbusAddr
addr
,
bool
state
);
bool
setParity
(
ModbusRTUMaster
*
mb
,
ModbusRTU
::
ModbusAddr
addr
,
mtrParity
p
);
bool
setDataBits
(
ModbusRTUMaster
*
mb
,
ModbusRTU
::
ModbusAddr
addr
,
mtrDataBits
d
);
ComPort
::
Parity
get_parity
(
ModbusRTU
::
ModbusData
data
);
ComPort
::
Speed
get_speed
(
ModbusRTU
::
ModbusData
data
);
// -------------------------------------------------------------------------
// .
bool
update_configuration
(
ModbusRTUMaster
*
mb
,
ModbusRTU
::
ModbusAddr
addr
,
const
std
::
string
mtrconfile
,
int
verbose
=
0
);
// ---------------------------
//
typedef
std
::
list
<
ModbusRTU
::
ModbusData
>
DataList
;
typedef
std
::
map
<
ModbusRTU
::
ModbusData
,
DataList
>
DataMap
;
static
int
attempts
=
3
;
//
static
const
ModbusRTU
::
ModbusData
skip
[]
=
{
48
,
49
,
59
};
// registers which should not write
bool
send_param
(
ModbusRTUMaster
*
mb
,
DataMap
&
dmap
,
ModbusRTU
::
ModbusAddr
addr
,
int
verb
);
bool
read_param
(
const
std
::
string
str
,
std
::
string
&
str1
,
std
::
string
&
str2
);
DataMap
read_confile
(
const
std
::
string
f
);
void
update_communication_params
(
ModbusRTU
::
ModbusAddr
reg
,
ModbusRTU
::
ModbusData
data
,
ModbusRTUMaster
*
mb
,
ModbusRTU
::
ModbusAddr
&
addr
,
int
verb
);
// -------------------------------------------------------------------------
static
const
int
u2size
=
2
;
// -------------------------------------------------------------------------
...
...
extensions/lib/MTR.cc
View file @
f6886e88
...
...
@@ -2,7 +2,10 @@
//! \version $Id: MTR.cc,v 1.1 2008/12/14 21:57:50 vpashka Exp $
// --------------------------------------------------------------------------
#include <cmath>
#include <vector>
#include <algorithm>
#include "modbus/ModbusRTUMaster.h"
#include "modbus/ModbusHelpers.h"
#include "MTR.h"
// --------------------------------------------------------------------------
using
namespace
std
;
...
...
@@ -207,5 +210,236 @@ std::string getSerialNumber( ModbusRTUMaster* mb, ModbusRTU::ModbusAddr addr )
return
""
;
}
// -----------------------------------------------------------------------------
DataMap
read_confile
(
const
std
::
string
f
)
{
bool
start
=
false
;
DataMap
dmap
;
std
::
ifstream
ifs
(
f
.
c_str
(),
std
::
ios
::
in
);
if
(
ifs
)
{
while
(
!
ifs
.
eof
()
)
{
std
::
string
str
;
if
(
getline
(
ifs
,
str
)
)
{
if
(
str
.
empty
()
)
continue
;
if
(
!
start
)
{
str
=
str
.
substr
(
0
,
str
.
size
()
-
1
);
// remove \n\r
// cout << "check str: " << str << endl;
if
(
str
==
"[Settings]"
)
{
start
=
true
;
continue
;
}
else
continue
;
}
string
s_reg
,
s_data
;
if
(
read_param
(
str
,
s_reg
,
s_data
)
)
{
ModbusRTU
::
ModbusData
reg
=
ModbusRTU
::
str2mbData
(
s_reg
);
/* we can write only registers > 40000 (see MTR-2 manual) */
if
(
reg
<=
40000
)
continue
;
reg
-=
40000
;
// cout << "reg=" << s_reg
// << " data=" << s_data << endl;
DataList
dlst
;
int
k
=
0
;
std
::
vector
<
unsigned
char
>
v
(
4
);
for
(
int
i
=
0
;
i
<
s_data
.
size
();
i
++
)
{
v
[
k
++
]
=
s_data
[
i
];
if
(
k
>
3
)
{
k
=
0
;
string
tmp
(
v
.
begin
(),
v
.
end
());
tmp
=
"0x"
+
tmp
;
// cout << "find data=" << ModbusRTU::str2mbData(tmp)
// << "(" << tmp << ")" << endl;
dlst
.
push_back
(
ModbusRTU
::
str2mbData
(
tmp
)
);
}
}
dmap
[
reg
]
=
dlst
;
}
}
}
}
ifs
.
close
();
return
dmap
;
}
// --------------------------------------------------------------------------
bool
read_param
(
const
std
::
string
str
,
std
::
string
&
str1
,
std
::
string
&
str2
)
{
string
::
size_type
pos
=
str
.
find
(
'='
);
if
(
pos
==
string
::
npos
)
return
false
;
str1
=
str
.
substr
(
0
,
pos
);
str2
=
str
.
substr
(
pos
+
1
,
str
.
size
());
return
true
;
}
// ------------------------------------------------------------------------------------------
ComPort
::
Speed
get_speed
(
ModbusRTU
::
ModbusData
data
)
{
static
const
ComPort
::
Speed
speed_conv
[]
=
{
ComPort
::
ComSpeed1200
,
ComPort
::
ComSpeed2400
,
ComPort
::
ComSpeed4800
,
ComPort
::
ComSpeed9600
,
ComPort
::
ComSpeed19200
,
ComPort
::
ComSpeed38400
,
ComPort
::
ComSpeed57600
,
ComPort
::
ComSpeed115200
};
if
(
data
>=
sizeof
(
speed_conv
)
/
sizeof
(
speed_conv
[
0
])
)
return
ComPort
::
ComSpeed0
;
return
speed_conv
[
data
];
}
// ------------------------------------------------------------------------------------------
ComPort
::
Parity
get_parity
(
ModbusRTU
::
ModbusData
data
)
{
static
const
ComPort
::
Parity
parity_conv
[]
=
{
ComPort
::
NoParity
,
ComPort
::
Odd
,
ComPort
::
Even
};
if
(
data
>=
sizeof
(
parity_conv
)
/
sizeof
(
parity_conv
[
0
])
)
return
ComPort
::
NoParity
;
return
parity_conv
[
data
];
}
// ------------------------------------------------------------------------------------------
void
update_communication_params
(
ModbusRTU
::
ModbusAddr
reg
,
ModbusRTU
::
ModbusData
data
,
ModbusRTUMaster
*
mb
,
ModbusRTU
::
ModbusAddr
&
addr
,
int
verb
)
{
if
(
reg
==
55
)
{
addr
=
data
;
if
(
verb
)
cout
<<
"(mtr-setup): slaveaddr is set to "
<<
ModbusRTU
::
addr2str
(
addr
)
<<
endl
;
}
else
if
(
reg
==
56
)
{
ComPort
::
Speed
speed
=
get_speed
(
data
);
if
(
speed
!=
ComPort
::
ComSpeed0
)
{
mb
->
setSpeed
(
speed
);
if
(
verb
)
cout
<<
"(mtr-setup): speed is set to "
<<
ComPort
::
getSpeed
(
speed
)
<<
endl
;
}
}
else
if
(
reg
==
57
)
{
if
(
data
==
0
)
mb
->
setStopBits
(
ComPort
::
OneBit
);
else
if
(
data
==
1
)
mb
->
setStopBits
(
ComPort
::
TwoBits
);
else
return
;
if
(
verb
)
cout
<<
"(mtr-setup): number of stop bits is set to "
<<
data
+
1
<<
endl
;
}
else
if
(
reg
==
58
)
{
if
(
data
!=
0
&&
data
!=
1
&&
data
!=
2
)
return
;
mb
->
setParity
(
get_parity
(
data
));
if
(
verb
)
cout
<<
"(mtr-setup): parity is set to "
<<
(
data
?
((
data
==
1
)
?
"odd"
:
"even"
)
:
"no"
)
<<
endl
;
}
}
// ------------------------------------------------------------------------------------------
bool
send_param
(
ModbusRTUMaster
*
mb
,
DataMap
&
dmap
,
ModbusRTU
::
ModbusAddr
addr
,
int
verb
)
{
if
(
!
mb
)
{
cerr
<<
"(MTR::send_param): mb=NULL!"
<<
endl
;
return
false
;
}
for
(
DataMap
::
iterator
it
=
dmap
.
begin
();
it
!=
dmap
.
end
();
++
it
)
{
// ModbusRTU::WriteOutputMessage msg(addr,it->first);
// cout << "send reg=" << ModbusRTU::dat2str(it->first)
// << "(" << it->first << ")" << endl;
int
reg
=
it
->
first
;
bool
ok
=
false
;
for
(
DataList
::
iterator
it1
=
it
->
second
.
begin
();
it1
!=
it
->
second
.
end
();
++
it1
,
reg
++
)
{
const
ModbusRTU
::
ModbusData
*
last
=
skip
+
sizeof
(
skip
)
/
sizeof
(
skip
[
0
]);
if
(
std
::
find
(
skip
,
last
,
reg
)
!=
last
)
continue
;
cout
<<
"send reg="
<<
ModbusRTU
::
dat2str
(
reg
)
<<
"("
<<
reg
<<
")"
<<
"="
<<
ModbusRTU
::
dat2str
(
(
*
it1
)
)
<<
endl
;
// ok=true;
// continue;
for
(
int
i
=
0
;
i
<
attempts
;
i
++
)
{
try
{
ModbusRTU
::
WriteSingleOutputRetMessage
ret
=
mb
->
write06
(
addr
,
reg
,(
*
it1
));
if
(
verb
)
cout
<<
"(mtr-setup): write reply: "
<<
ret
<<
endl
;
update_communication_params
(
reg
,
*
it1
,
mb
,
addr
,
verb
);
ok
=
true
;
break
;
}
catch
(
ModbusRTU
::
mbException
&
ex
)
{
/* if speed is changed we receive a timeout error */
if
(
reg
==
56
&&
it
->
first
==
ModbusRTU
::
erTimeOut
)
{
update_communication_params
(
reg
,
*
it1
,
mb
,
addr
,
verb
);
ok
=
true
;
break
;
}
else
{
cerr
<<
"(mtr-setup): error for write reg="
<<
ModbusRTU
::
dat2str
(
reg
)
<<
"("
<<
it
->
first
<<
"): "
<<
ex
<<
endl
;
}
}
}
}
// if( !ok )
// return false;
}
return
true
;
}
// ------------------------------------------------------------------------------------------
bool
update_configuration
(
ModbusRTUMaster
*
mb
,
ModbusRTU
::
ModbusAddr
slaveaddr
,
const
std
::
string
mtrconfile
,
int
verb
)
{
std
::
string
m
=
MTR
::
getModelNumber
(
mb
,
slaveaddr
);
if
(
m
!=
"MTR315Transducer"
)
{
cerr
<<
"(mtr-setup): model number != 'MTR315Transducer' (read: "
<<
m
<<
")"
<<
endl
;
return
false
;
}
DataMap
dmap
=
MTR
::
read_confile
(
mtrconfile
);
if
(
dmap
.
empty
()
)
{
cerr
<<
"(mtr-setup): error read confile="
<<
mtrconfile
<<
endl
;
return
false
;
}
if
(
send_param
(
mb
,
dmap
,
slaveaddr
,
verb
)
)
return
true
;
return
false
;
}
// ------------------------------------------------------------------------------------------
}
// end of namespace MTR
// -----------------------------------------------------------------------------
include/Configuration.h
View file @
f6886e88
...
...
@@ -107,6 +107,7 @@ namespace UniSetTypes
xmlNode
*
getXMLObjectsSection
();
xmlNode
*
getXMLControllersSection
();
xmlNode
*
getXMLServicesSection
();
xmlNode
*
getXMLObjectNode
(
UniSetTypes
::
ObjectId
);
// net
inline
unsigned
int
getCountOfNet
()
const
{
return
countOfNet
;
}
...
...
include/IONotifyController.h
View file @
f6886e88
...
...
@@ -280,6 +280,7 @@ class IONotifyController:
void
onChangeUndefined
(
DependsList
::
iterator
it
,
bool
undefined
);
UniSetTypes
::
uniset_mutex
sig_mutex
;
ChangeSignal
changeSignal
;
private
:
...
...
include/UniSetTypes.h
View file @
f6886e88
...
...
@@ -118,9 +118,14 @@ namespace UniSetTypes
/*! Информация об имени объекта */
struct
ObjectInfo
{
ObjectInfo
()
:
id
(
DefaultObjectId
),
repName
(
0
),
textName
(
0
),
data
(
0
){}
ObjectId
id
;
/*!< идентификатор */
char
*
repName
;
/*!< текстовое имя для регистрации в репозитории */
char
*
textName
;
/*!< текстовое имя */
void
*
data
;
};
typedef
std
::
list
<
NodeInfo
>
ListOfNode
;
...
...
include/UniversalInterface.h
View file @
f6886e88
...
...
@@ -196,6 +196,9 @@ class UniversalInterface
UniSetTypes
::
ObjectType
getType
(
UniSetTypes
::
ObjectId
id
,
UniSetTypes
::
ObjectId
node
)
throw
(
IO_THROW_EXCEPTIONS
);
UniSetTypes
::
ObjectType
getType
(
UniSetTypes
::
ObjectId
id
);
// read from xml (only for xml!)
UniversalIO
::
IOTypes
getConfIOType
(
UniSetTypes
::
ObjectId
id
);
IOController_i
::
ShortIOInfo
getChangedTime
(
UniSetTypes
::
ObjectId
id
,
UniSetTypes
::
ObjectId
node
);
IOController_i
::
ShortMapSeq
*
getSensors
(
UniSetTypes
::
ObjectId
id
,
UniSetTypes
::
ObjectId
node
=
UniSetTypes
::
conf
->
getLocalNode
()
);
...
...
src/Interfaces/UniversalInterface.cc
View file @
f6886e88
...
...
@@ -3101,3 +3101,16 @@ bool UniversalInterface::waitWorking( UniSetTypes::ObjectId id, int msec, int pm
}
// -----------------------------------------------------------------------------
UniversalIO
::
IOTypes
UniversalInterface
::
getConfIOType
(
UniSetTypes
::
ObjectId
id
)
{
if
(
!
conf
)
return
UniversalIO
::
UnknownIOType
;
xmlNode
*
x
=
conf
->
getXMLObjectNode
(
id
);
if
(
!
x
)
return
UniversalIO
::
UnknownIOType
;
UniXML_iterator
it
(
x
);
return
UniSetTypes
::
getIOType
(
it
.
getProp
(
"iotype"
)
);
}
// -----------------------------------------------------------------------------
src/ObjectRepository/ObjectIndex_XML.cc
View file @
f6886e88
...
...
@@ -188,6 +188,8 @@ unsigned int ObjectIndex_XML::read_section( UniXML& xml, const std::string sec,
delete
[]
omap
[
ind
].
textName
;
omap
[
ind
].
textName
=
new
char
[
textname
.
size
()
+
1
];
strcpy
(
omap
[
ind
].
textName
,
textname
.
c_str
()
);
omap
[
ind
].
data
=
(
void
*
)(
xmlNode
*
)
it
;
// cout << "read: " << "(" << ind << ") " << omap[ind].repName << "\t" << omap[ind].textName << endl;
ind
++
;
...
...
@@ -257,6 +259,7 @@ unsigned int ObjectIndex_XML::read_nodes( UniXML& xml, const std::string sec, un
omap
[
ind
].
textName
=
new
char
[
textname
.
size
()
+
1
];
strcpy
(
omap
[
ind
].
textName
,
textname
.
c_str
()
);
omap
[
ind
].
data
=
(
void
*
)(
xmlNode
*
)(
it
);
//
mok
[
omap
[
ind
].
repName
]
=
ind
;
...
...
src/ObjectRepository/ObjectIndex_idXML.cc
View file @
f6886e88
...
...
@@ -157,6 +157,9 @@ void ObjectIndex_idXML::read_section( UniXML& xml, const std::string sec )
inf
.
textName
=
new
char
[
textname
.
size
()
+
1
];
strcpy
(
inf
.
textName
,
textname
.
c_str
()
);
inf
.
data
=
(
void
*
)(
xmlNode
*
)(
it
);
omap
[
inf
.
id
]
=
inf
;
}
}
...
...
@@ -211,6 +214,8 @@ void ObjectIndex_idXML::read_nodes( UniXML& xml, const std::string sec )
inf
.
textName
=
new
char
[
textname
.
size
()
+
1
];
strcpy
(
inf
.
textName
,
textname
.
c_str
()
);
inf
.
data
=
(
void
*
)(
xmlNode
*
)(
it
);
omap
[
inf
.
id
]
=
inf
;
}
...
...
src/Processes/IONotifyController.cc
View file @
f6886e88
...
...
@@ -494,6 +494,7 @@ void IONotifyController::localSaveState( IOController::DIOStateList::iterator& i
try
{
uniset_mutex_lock
l
(
sig_mutex
,
500
);
changeSignal
.
emit
(
&
sm
);
}
catch
(...){}
...
...
@@ -557,6 +558,7 @@ void IONotifyController::localSaveValue( IOController::AIOStateList::iterator& l
try
{
uniset_mutex_lock
l
(
sig_mutex
,
500
);
changeSignal
.
emit
(
&
sm
);
}
catch
(...){}
...
...
@@ -1201,6 +1203,7 @@ void IONotifyController::localSetState( IOController::DIOStateList::iterator& it
try
{
uniset_mutex_lock
l
(
sig_mutex
,
500
);
changeSignal
.
emit
(
&
sm
);
}
catch
(...){}
...
...
@@ -1257,6 +1260,7 @@ void IONotifyController::localSetValue( IOController::AIOStateList::iterator& li
try
{
uniset_mutex_lock
l
(
sig_mutex
,
500
);
changeSignal
.
emit
(
&
sm
);
}
catch
(...){}
...
...
src/Various/Configuration.cc
View file @
f6886e88
...
...
@@ -1012,6 +1012,15 @@ xmlNode* Configuration::getXMLServicesSection()
return
xmlServicesSec
;
}
// -------------------------------------------------------------------------
xmlNode
*
Configuration
::
getXMLObjectNode
(
UniSetTypes
::
ObjectId
id
)
{
const
ObjectInfo
*
i
=
oind
->
getObjectInfo
(
id
);
if
(
i
)
return
(
xmlNode
*
)(
i
->
data
);
return
0
;
}
// -------------------------------------------------------------------------
void
uniset_init
(
int
argc
,
const
char
*
const
*
argv
,
const
std
::
string
xmlfile
)
{
string
confile
=
UniSetTypes
::
getArgParam
(
"--confile"
,
argc
,
argv
,
xmlfile
);
...
...
tests/ui.cc
View file @
f6886e88
...
...
@@ -11,6 +11,25 @@ int main( int argc, const char **argv )
{
uniset_init
(
argc
,
argv
,
"test.xml"
);
UniversalInterface
ui
;
cout
<<
"** check getSensorID function **"
<<
endl
;
ObjectId
id1
=
conf
->
getSensorID
(
"Input1_S"
);
if
(
id1
!=
1
)
{
cout
<<
"** FAILED! check getSensorID function **"
<<
endl
;
return
1
;
}
cout
<<
"** check getConfIOType function **"
<<
endl
;
UniversalIO
::
IOTypes
t
=
ui
.
getConfIOType
(
id1
);
cout
<<
"sensor ID="
<<
id1
<<
" iotype="
<<
t
<<
endl
;
if
(
t
!=
UniversalIO
::
DigitalInput
)
{
cout
<<
"** FAILED! check getSensorID function **"
<<
endl
;
return
1
;
}
int
id
=
conf
->
getArgInt
(
"--sid"
);
if
(
id
<=
0
)
...
...
@@ -19,9 +38,8 @@ int main( int argc, const char **argv )
return
1
;
}
UniversalInterface
ui
;
cout
<<
"getChangedTime for ID="
<<
id
<<
":"
<<
endl
;
cout
<<
"
** check
getChangedTime for ID="
<<
id
<<
":"
<<
endl
;
IOController_i
::
ShortIOInfo
inf
=
ui
.
getChangedTime
(
id
,
conf
->
getLocalNode
());
...
...
@@ -33,6 +51,7 @@ int main( int argc, const char **argv )
cout
<<
"id="
<<
id
<<
" value="
<<
inf
.
value
<<
" last changed: "
<<
string
(
t_str
)
<<
endl
;
}
catch
(
Exception
&
ex
)
{
...
...
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