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
4139b7d7
Commit
4139b7d7
authored
Mar 14, 2010
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add getConfIOType function to UniversalInterface.
parent
ce4ba08d
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
62 additions
and
3 deletions
+62
-3
libuniset.spec
conf/libuniset.spec
+1
-1
Configuration.h
include/Configuration.h
+1
-0
UniSetTypes.h
include/UniSetTypes.h
+5
-0
UniversalInterface.h
include/UniversalInterface.h
+3
-0
UniversalInterface.cc
src/Interfaces/UniversalInterface.cc
+14
-0
ObjectIndex_XML.cc
src/ObjectRepository/ObjectIndex_XML.cc
+3
-0
ObjectIndex_idXML.cc
src/ObjectRepository/ObjectIndex_idXML.cc
+5
-0
Configuration.cc
src/Various/Configuration.cc
+9
-0
ui.cc
tests/ui.cc
+21
-2
No files found.
conf/libuniset.spec
View file @
4139b7d7
...
...
@@ -3,7 +3,7 @@
Name: libuniset
Version: 0.97
Release: eter5
8
Release: eter5
9
Summary: UniSet - library for building distributed industrial control systems
License: GPL
Group: Development/C++
...
...
include/Configuration.h
View file @
4139b7d7
...
...
@@ -107,6 +107,7 @@ namespace UniSetTypes
xmlNode
*
getXMLObjectsSection
();
xmlNode
*
getXMLControllersSection
();
xmlNode
*
getXMLServicesSection
();
xmlNode
*
getObjectInfo
(
UniSetTypes
::
ObjectId
);
// net
inline
unsigned
int
getCountOfNet
()
const
{
return
countOfNet
;
}
...
...
include/UniSetTypes.h
View file @
4139b7d7
...
...
@@ -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 @
4139b7d7
...
...
@@ -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 @
4139b7d7
...
...
@@ -3101,3 +3101,17 @@ 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
->
getObjectInfo
(
id
);
if
(
!
x
)
return
UniversalIO
::
UnknownIOType
;
UniXML_iterator
it
(
x
);
return
UniSetTypes
::
getIOType
(
it
.
getProp
(
"iotype"
)
);
}
// -----------------------------------------------------------------------------
src/ObjectRepository/ObjectIndex_XML.cc
View file @
4139b7d7
...
...
@@ -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 @
4139b7d7
...
...
@@ -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/Various/Configuration.cc
View file @
4139b7d7
...
...
@@ -1012,6 +1012,15 @@ xmlNode* Configuration::getXMLServicesSection()
return
xmlServicesSec
;
}
// -------------------------------------------------------------------------
xmlNode
*
Configuration
::
getObjectInfo
(
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 @
4139b7d7
...
...
@@ -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