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
0cd82222
Commit
0cd82222
authored
Aug 17, 2009
by
Ivan Donchevskiy
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of git.eter:/projects/uniset
parents
6e74886d
8f32358b
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
215 additions
and
7 deletions
+215
-7
IOController_i.idl
IDL/Processes/IOController_i.idl
+12
-0
libuniset.spec
conf/libuniset.spec
+13
-1
IOController.h
include/IOController.h
+2
-0
UniversalInterface.h
include/UniversalInterface.h
+6
-3
UniversalInterface.cc
src/Interfaces/UniversalInterface.cc
+72
-0
ObjectsManager.cc
src/ObjectRepository/ObjectsManager.cc
+4
-2
IOController.cc
src/Processes/IOController.cc
+38
-0
Makefile.am
tests/Makefile.am
+7
-1
create_links.sh
tests/create_links.sh
+4
-0
ui.cc
tests/ui.cc
+48
-0
uitest.sh
tests/uitest.sh
+9
-0
No files found.
IDL/Processes/IOController_i.idl
View file @
0cd82222
...
...
@@ -182,6 +182,18 @@ interface IOController_i : ObjectsManager_i
ӣ
.
*/
UniSetTypes
::
IDSeq
setOutputSeq
(
in
OutSeq
lst
,
in
UniSetTypes
::
ObjectId
sup_id
)
;
/*
!
*/
struct
ShortIOInfo
{
long
value
;
long
tv_sec
; /*!< , (gettimeofday) */
long
tv_usec
; /*!< , (gettimeofday) */
}
;
ShortIOInfo
getChangedTime
(
in
SensorInfo
si
)
raises
(
NameNotFound
)
;
}
;
//
--------------------------------------------------------------------------------------------------------------
...
...
conf/libuniset.spec
View file @
0cd82222
...
...
@@ -3,7 +3,7 @@
Name: libuniset
Version: 0.96
Release: eter
39
Release: eter
45
Summary: UniSet - library for building distributed industrial control systems
...
...
@@ -177,6 +177,18 @@ rm -f %buildroot%_libdir/*.la
%exclude %_pkgconfigdir/libUniSet.pc
%changelog
* Fri Aug 14 2009 Pavel Vainerman <pv@altlinux.ru> 0.96-eter44
- new build
* Thu Aug 13 2009 Pavel Vainerman <pv@altlinux.ru> 0.96-eter41
- new build
* Wed Aug 12 2009 Pavel Vainerman <pv@altlinux.ru> 0.96-eter40
- new build
* Wed Aug 12 2009 Pavel Vainerman <pv@altlinux.ru> 0.96-eter39
- new build
* Thu Aug 06 2009 Pavel Vainerman <pv@altlinux.ru> 0.96-eter38
- new build
...
...
include/IOController.h
View file @
0cd82222
...
...
@@ -122,6 +122,8 @@ class IOController:
UniSetTypes
::
Message
::
Priority
getPriority
(
const
IOController_i
::
SensorInfo
&
si
,
UniversalIO
::
IOTypes
type
);
virtual
IOController_i
::
ShortIOInfo
getChangedTime
(
const
IOController_i
::
SensorInfo
&
si
);
public
:
struct
DependsInfo
;
...
...
include/UniversalInterface.h
View file @
0cd82222
...
...
@@ -176,7 +176,7 @@ class UniversalInterface
UniSetTypes
::
ObjectId
backid
=
UniSetTypes
::
DefaultObjectId
);
void
askRemoteOutput
(
UniSetTypes
::
ObjectId
id
,
UniversalIO
::
UIOCommand
cmd
,
UniSetTypes
::
ObjectId
node
,
UniSetTypes
::
ObjectId
backid
=
UniSetTypes
::
DefaultObjectId
)
throw
(
IO_THROW_EXCEPTIONS
);
UniSetTypes
::
ObjectId
backid
=
UniSetTypes
::
DefaultObjectId
)
throw
(
IO_THROW_EXCEPTIONS
);
//!
void
askTimer
(
UniSetTypes
::
TimerId
timerid
,
CORBA
::
Long
timeMS
,
CORBA
::
Short
ticks
=-
1
,
...
...
@@ -191,11 +191,14 @@ class UniversalInterface
UniSetTypes
::
ObjectId
backid
=
UniSetTypes
::
DefaultObjectId
)
throw
(
IO_THROW_EXCEPTIONS
);
UniversalIO
::
IOTypes
getIOType
(
UniSetTypes
::
ObjectId
id
,
UniSetTypes
::
ObjectId
node
)
throw
(
IO_THROW_EXCEPTIONS
);
UniversalIO
::
IOTypes
getIOType
(
UniSetTypes
::
ObjectId
id
,
UniSetTypes
::
ObjectId
node
)
throw
(
IO_THROW_EXCEPTIONS
);
UniversalIO
::
IOTypes
getIOType
(
UniSetTypes
::
ObjectId
id
);
UniSetTypes
::
ObjectType
getType
(
UniSetTypes
::
ObjectId
id
,
UniSetTypes
::
ObjectId
node
)
throw
(
IO_THROW_EXCEPTIONS
);
UniSetTypes
::
ObjectType
getType
(
UniSetTypes
::
ObjectId
id
,
UniSetTypes
::
ObjectId
node
)
throw
(
IO_THROW_EXCEPTIONS
);
UniSetTypes
::
ObjectType
getType
(
UniSetTypes
::
ObjectId
id
);
IOController_i
::
ShortIOInfo
getChangedTime
(
UniSetTypes
::
ObjectId
id
,
UniSetTypes
::
ObjectId
node
);
// /*! */
void
registered
(
UniSetTypes
::
ObjectId
id
,
const
UniSetTypes
::
ObjectPtr
oRef
,
bool
force
=
false
)
throw
(
UniSetTypes
::
ORepFailed
);
void
registered
(
UniSetTypes
::
ObjectId
id
,
UniSetTypes
::
ObjectId
node
,
const
UniSetTypes
::
ObjectPtr
oRef
,
bool
force
=
false
)
throw
(
UniSetTypes
::
ORepFailed
);
...
...
src/Interfaces/UniversalInterface.cc
View file @
0cd82222
...
...
@@ -2188,6 +2188,78 @@ void UniversalInterface::fastSaveState( IOController_i::SensorInfo& si, bool sta
}
// ------------------------------------------------------------------------------------------------------------
IOController_i
::
ShortIOInfo
UniversalInterface
::
getChangedTime
(
UniSetTypes
::
ObjectId
id
,
UniSetTypes
::
ObjectId
node
)
{
if
(
id
==
DefaultObjectId
)
throw
ORepFailed
(
"UI(getChangedTime): Unknown id=UniSetTypes::DefaultObjectId"
);
IOController_i
::
SensorInfo
si
;
si
.
id
=
id
;
si
.
node
=
node
;
try
{
CORBA
::
Object_var
oref
;
try
{
oref
=
rcache
.
resolve
(
si
.
id
,
si
.
node
);
}
catch
(
NameNotFound
){}
for
(
unsigned
int
i
=
0
;
i
<
uconf
->
getRepeatCount
();
i
++
)
{
try
{
if
(
CORBA
::
is_nil
(
oref
)
)
oref
=
resolve
(
si
.
id
,
si
.
node
);
IOController_i_var
iom
=
IOController_i
::
_narrow
(
oref
);
return
iom
->
getChangedTime
(
si
);
}
catch
(
CORBA
::
TRANSIENT
){}
catch
(
CORBA
::
OBJECT_NOT_EXIST
){}
catch
(
CORBA
::
SystemException
&
ex
){}
msleep
(
uconf
->
getRepeatTimeout
());
oref
=
CORBA
::
Object
::
_nil
();
}
}
catch
(
UniSetTypes
::
TimeOut
){}
catch
(
IOController_i
::
NameNotFound
&
ex
)
{
rcache
.
erase
(
si
.
id
,
si
.
node
);
unideb
[
Debug
::
WARN
]
<<
"UI(getChangedTime): "
<<
ex
.
err
<<
endl
;
}
catch
(
ORepFailed
)
{
rcache
.
erase
(
si
.
id
,
si
.
node
);
unideb
[
Debug
::
WARN
]
<<
set_err
(
"UI(getChangedTime): "
,
si
.
id
,
si
.
node
)
<<
endl
;
}
catch
(
CORBA
::
NO_IMPLEMENT
)
{
rcache
.
erase
(
si
.
id
,
si
.
node
);
unideb
[
Debug
::
WARN
]
<<
set_err
(
"UI(getChangedTime): "
,
si
.
id
,
si
.
node
)
<<
endl
;
}
catch
(
CORBA
::
OBJECT_NOT_EXIST
)
{
rcache
.
erase
(
si
.
id
,
si
.
node
);
unideb
[
Debug
::
WARN
]
<<
set_err
(
"UI(getChangedTime): "
,
si
.
id
,
si
.
node
)
<<
endl
;
}
catch
(
CORBA
::
COMM_FAILURE
)
{
//
// unideb[Debug::WARN] << "UI(saveState): CORBA::COMM_FAILURE " << endl;
}
catch
(
CORBA
::
SystemException
&
ex
)
{
//
// unideb[Debug::WARN] << "UI(saveState): CORBA::SystemException" << endl;
}
catch
(...){}
rcache
.
erase
(
si
.
id
,
si
.
node
);
throw
UniSetTypes
::
TimeOut
(
set_err
(
"UI(getChangedTime): TimeOut "
,
si
.
id
,
si
.
node
));
}
// ------------------------------------------------------------------------------------------------------------
ObjectPtr
UniversalInterface
::
CacheOfResolve
::
resolve
(
ObjectId
id
,
ObjectId
node
)
throw
(
NameNotFound
)
...
...
src/ObjectRepository/ObjectsManager.cc
View file @
0cd82222
...
...
@@ -235,7 +235,7 @@ void ObjectsManager::managers(OManagerCommand cmd)
}
catch
(
Exception
&
ex
)
{
unideb
[
Debug
::
CRIT
]
<<
myname
<<
"(managers): "
<<
ex
<<
endl
;
unideb
[
Debug
::
CRIT
]
<<
myname
<<
"(managers): "
<<
ex
<<
endl
;
unideb
[
Debug
::
CRIT
]
<<
myname
<<
"(managers): () -->"
<<
(
*
li
)
->
getName
()
<<
endl
;
}
catch
(
CORBA
::
SystemException
&
ex
)
...
...
@@ -304,7 +304,9 @@ void ObjectsManager::objects(OManagerCommand cmd)
}
catch
(
CORBA
::
Exception
&
ex
)
{
unideb
[
Debug
::
CRIT
]
<<
myname
<<
"(objects): Caught CORBA::Exception."
<<
endl
;
unideb
[
Debug
::
CRIT
]
<<
myname
<<
"(objects): Caught CORBA::Exception. "
<<
ex
.
_name
()
<<
" ("
<<
(
*
li
)
->
getName
()
<<
")"
<<
endl
;
}
catch
(
omniORB
::
fatalException
&
fe
)
{
...
...
src/Processes/IOController.cc
View file @
0cd82222
...
...
@@ -913,7 +913,10 @@ IOController_i::DigitalIOInfo IOController::getDInfo(const IOController_i::Senso
{
DIOStateList
::
iterator
it
=
dioList
.
find
(
key
(
si
.
id
,
si
.
node
)
);
if
(
it
!=
dioList
.
end
()
)
{
uniset_spin_lock
lock
(
it
->
second
.
val_lock
,
checkLockValuePause
);
return
it
->
second
;
}
// -------------
ostringstream
err
;
...
...
@@ -926,7 +929,10 @@ IOController_i::AnalogIOInfo IOController::getAInfo(const IOController_i::Sensor
{
AIOStateList
::
iterator
it
=
aioList
.
find
(
key
(
si
.
id
,
si
.
node
)
);
if
(
it
!=
aioList
.
end
()
)
{
uniset_spin_lock
lock
(
it
->
second
.
val_lock
,
checkLockValuePause
);
return
it
->
second
;
}
// -------------
ostringstream
err
;
...
...
@@ -1362,3 +1368,35 @@ IDSeq* IOController::setOutputSeq(const IOController_i::OutSeq& lst, ObjectId su
return
badlist
.
getIDSeq
();
}
// -----------------------------------------------------------------------------
IOController_i
::
ShortIOInfo
IOController
::
getChangedTime
(
const
IOController_i
::
SensorInfo
&
si
)
{
DIOStateList
::
iterator
dit
=
dioList
.
find
(
key
(
si
.
id
,
si
.
node
)
);
if
(
dit
!=
dioList
.
end
()
)
{
IOController_i
::
ShortIOInfo
i
;
uniset_spin_lock
lock
(
dit
->
second
.
val_lock
,
checkLockValuePause
);
i
.
value
=
dit
->
second
.
state
?
1
:
0
;
i
.
tv_sec
=
dit
->
second
.
tv_sec
;
i
.
tv_usec
=
dit
->
second
.
tv_usec
;
return
i
;
}
AIOStateList
::
iterator
ait
=
aioList
.
find
(
key
(
si
.
id
,
si
.
node
)
);
if
(
ait
!=
aioList
.
end
()
)
{
IOController_i
::
ShortIOInfo
i
;
uniset_spin_lock
lock
(
ait
->
second
.
val_lock
,
checkLockValuePause
);
i
.
value
=
ait
->
second
.
value
;
i
.
tv_sec
=
ait
->
second
.
tv_sec
;
i
.
tv_usec
=
ait
->
second
.
tv_usec
;
return
i
;
}
// -------------
ostringstream
err
;
err
<<
myname
<<
"(getChangedTime): () "
<<
conf
->
oind
->
getNameById
(
si
.
id
)
<<
" "
;
unideb
[
Debug
::
INFO
]
<<
err
.
str
()
<<
endl
;
throw
IOController_i
::
NameNotFound
(
err
.
str
().
c_str
());
}
// -----------------------------------------------------------------------------
tests/Makefile.am
View file @
0cd82222
...
...
@@ -2,10 +2,16 @@
# This file is part of the UniSet library #
############################################################################
noinst_PROGRAMS
=
passivetimer
noinst_PROGRAMS
=
passivetimer ui
passivetimer_SOURCES
=
passivetimer.cc
passivetimer_LDADD
=
$(top_builddir)
/lib/libUniSet.la
passivetimer_CPPFLAGS
=
-I
$(top_builddir)
/include
ui_SOURCES
=
ui.cc
ui_LDADD
=
$(top_builddir)
/lib/libUniSet.la
ui_CPPFLAGS
=
-I
$(top_builddir)
/include
include
$(top_builddir)/conf/setting.mk
tests/create_links.sh
0 → 100755
View file @
0cd82222
#!/bin/sh
ln
-s
-f
/usr/bin/uniset-stop.sh stop.sh
ln
-s
-f
../conf/test.xml test.xml
tests/ui.cc
0 → 100644
View file @
0cd82222
#include <time.h>
#include "UniversalInterface.h"
#include "UniSetTypes.h"
using
namespace
std
;
using
namespace
UniSetTypes
;
int
main
(
int
argc
,
const
char
**
argv
)
{
try
{
uniset_init
(
argc
,
argv
,
"test.xml"
);
int
id
=
conf
->
getArgInt
(
"--sid"
);
if
(
id
<=
0
)
{
cerr
<<
"unknown sensor ID. Use --sid "
<<
endl
;
return
1
;
}
UniversalInterface
ui
;
cout
<<
"getChangedTime for ID="
<<
id
<<
":"
<<
endl
;
IOController_i
::
ShortIOInfo
inf
=
ui
.
getChangedTime
(
id
,
conf
->
getLocalNode
());
struct
tm
*
tms
=
localtime
(
&
inf
.
tv_sec
);
char
t_str
[
150
];
strftime
(
t_str
,
sizeof
(
t_str
),
"%d %b %Y %H:%M:%S"
,
tms
);
cout
<<
"id="
<<
id
<<
" value="
<<
inf
.
value
<<
" last changed: "
<<
string
(
t_str
)
<<
endl
;
}
catch
(
Exception
&
ex
)
{
cout
<<
"(uitest):"
<<
ex
<<
endl
;
}
catch
(...)
{
cout
<<
"(uitest): catch ..."
<<
endl
;
}
return
0
;
}
tests/uitest.sh
0 → 100755
View file @
0cd82222
#!/bin/sh
SID
=
$1
[
-z
"
$SID
"
]
&&
SID
=
1
uniset-start.sh
-f
./ui
--confile
test.xml
--sid
$SID
#--unideb-add-levels system,info,level9
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