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
3bb178a2
Commit
3bb178a2
authored
Dec 17, 2013
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(2.0): Исправил ошибку с инициализацией USensorInfo
parent
c7609b05
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
70 additions
and
68 deletions
+70
-68
IOController.h
include/IOController.h
+19
-16
IONotifyController.h
include/IONotifyController.h
+1
-1
NCRestorer.h
include/NCRestorer.h
+2
-2
UniversalInterface.cc
src/Interfaces/UniversalInterface.cc
+1
-1
IOController.cc
src/Processes/IOController.cc
+34
-38
IONotifyController.cc
src/Processes/IONotifyController.cc
+4
-4
NCRestorer.cc
src/Processes/NCRestorer.cc
+8
-4
NCRestorer_XML.cc
src/Processes/NCRestorer_XML.cc
+1
-1
ui.cc
tests/ui.cc
+0
-1
No files found.
include/IOController.h
View file @
3bb178a2
...
...
@@ -99,8 +99,8 @@ class IOController:
public
:
// предварительное объявление, чтобы в структуре объявить итератор..
struct
USensorI
OI
nfo
;
typedef
std
::
map
<
UniSetTypes
::
KeyType
,
USensorI
OI
nfo
>
IOStateList
;
struct
USensorInfo
;
typedef
std
::
map
<
UniSetTypes
::
KeyType
,
USensorInfo
>
IOStateList
;
// ================== Достпуные сигналы =================
...
...
@@ -125,25 +125,29 @@ class IOController:
// -----------------------------------------------------------------------------------------
struct
USensorI
OI
nfo
:
struct
USensorInfo
:
public
IOController_i
::
SensorIOInfo
{
USensorI
OInfo
()
:
any
(
0
),
db_ignore
(
false
),
d_value
(
0
),
d_off_value
(
0
)
USensorI
nfo
()
:
any
(
0
),
d_value
(
0
),
d_off_value
(
0
)
{
undefined
=
false
;
d_si
.
id
=
UniSetTypes
::
DefaultObjectId
;
d_si
.
node
=
UniSetTypes
::
DefaultObjectId
;
value
=
default_val
;
real_value
=
default_val
;
dbignore
=
false
;
undefined
=
false
;
blocked
=
false
;
}
virtual
~
USensorI
OI
nfo
(){}
virtual
~
USensorInfo
(){}
USensorI
OI
nfo
(
IOController_i
::
SensorIOInfo
&
r
);
USensorI
OI
nfo
(
IOController_i
::
SensorIOInfo
*
r
);
USensorI
OI
nfo
(
const
IOController_i
::
SensorIOInfo
&
r
);
USensorInfo
(
IOController_i
::
SensorIOInfo
&
r
);
USensorInfo
(
IOController_i
::
SensorIOInfo
*
r
);
USensorInfo
(
const
IOController_i
::
SensorIOInfo
&
r
);
USensorI
OI
nfo
&
operator
=
(
IOController_i
::
SensorIOInfo
&
r
);
const
USensorI
OI
nfo
&
operator
=
(
const
IOController_i
::
SensorIOInfo
&
r
);
USensorI
OI
nfo
&
operator
=
(
IOController_i
::
SensorIOInfo
*
r
);
USensorInfo
&
operator
=
(
IOController_i
::
SensorIOInfo
&
r
);
const
USensorInfo
&
operator
=
(
const
IOController_i
::
SensorIOInfo
&
r
);
USensorInfo
&
operator
=
(
IOController_i
::
SensorIOInfo
*
r
);
// Дополнительные (вспомогательные поля)
UniSetTypes
::
uniset_rwmutex
val_lock
;
/*!< флаг блокирующий работу со значением */
...
...
@@ -151,7 +155,6 @@ class IOController:
IOStateList
::
iterator
it
;
void
*
any
;
/*!< расширение для возможности хранения своей информации */
bool
db_ignore
;
/*!< не писать изменения в БД */
// сигнал для реализации механизма зависимостией..
// (все зависимые датчики подключаются к нему (см. NCRestorer::init_depends_signals)
...
...
@@ -198,7 +201,7 @@ class IOController:
/*! регистрация датчика
force=true - не проверять на дублирование (оптимизация)
*/
void
ioRegistration
(
const
USensorI
OI
nfo
&
,
bool
force
=
false
);
void
ioRegistration
(
const
USensorInfo
&
,
bool
force
=
false
);
/*! разрегистрация датчика */
void
ioUnRegistration
(
const
IOController_i
::
SensorInfo
&
si
);
...
...
@@ -248,7 +251,7 @@ class IOController:
// --------------------------
// ФИЛЬТРОВАНИЕ
//
typedef
sigc
::
slot
<
bool
,
const
USensorI
OI
nfo
&
,
CORBA
::
Long
,
UniSetTypes
::
ObjectId
>
IOFilterSlot
;
typedef
sigc
::
slot
<
bool
,
const
USensorInfo
&
,
CORBA
::
Long
,
UniSetTypes
::
ObjectId
>
IOFilterSlot
;
typedef
std
::
list
<
IOFilterSlot
>
IOFilterSlotList
;
/*
...
...
@@ -263,7 +266,7 @@ class IOController:
void
eraseIOFilter
(
IOFilterSlotList
::
iterator
&
it
);
// функии проверки текущего значения
bool
checkIOFilters
(
const
USensorI
OI
nfo
&
ai
,
CORBA
::
Long
&
newvalue
,
UniSetTypes
::
ObjectId
sup_id
);
bool
checkIOFilters
(
const
USensorInfo
&
ai
,
CORBA
::
Long
&
newvalue
,
UniSetTypes
::
ObjectId
sup_id
);
inline
bool
iofiltersEmpty
(){
return
iofilters
.
empty
();
}
inline
int
iodiltersSize
(){
return
iofilters
.
size
();
}
...
...
include/IONotifyController.h
View file @
3bb178a2
...
...
@@ -239,7 +239,7 @@ class IONotifyController:
virtual
bool
activateObject
();
// ФИЛЬТРЫ
bool
myIOFilter
(
const
USensorI
OI
nfo
&
ai
,
CORBA
::
Long
newvalue
,
UniSetTypes
::
ObjectId
sup_id
);
bool
myIOFilter
(
const
USensorInfo
&
ai
,
CORBA
::
Long
newvalue
,
UniSetTypes
::
ObjectId
sup_id
);
//! посылка информации об изменении состояния датчика
virtual
void
send
(
ConsumerList
&
lst
,
UniSetTypes
::
SensorMessage
&
sm
);
...
...
include/NCRestorer.h
View file @
3bb178a2
...
...
@@ -43,7 +43,7 @@ class NCRestorer
virtual
~
NCRestorer
();
struct
SInfo
:
public
IOController
::
USensorI
OI
nfo
public
IOController
::
USensorInfo
{
SInfo
(
IOController_i
::
SensorInfo
&
si
,
UniversalIO
::
IOType
&
t
,
UniSetTypes
::
Message
::
Message
::
Priority
&
p
,
long
&
def
)
...
...
@@ -76,7 +76,7 @@ class NCRestorer
// добавление списка порогов и заказчиков
static
void
addthresholdlist
(
IONotifyController
*
ic
,
SInfo
&
inf
,
IONotifyController
::
ThresholdExtList
&
lst
,
bool
force
=
false
);
static
inline
void
ioRegistration
(
IONotifyController
*
ic
,
IOController
::
USensorI
OI
nfo
&
inf
,
bool
force
=
false
)
static
inline
void
ioRegistration
(
IONotifyController
*
ic
,
IOController
::
USensorInfo
&
inf
,
bool
force
=
false
)
{
ic
->
ioRegistration
(
inf
,
force
);
}
...
...
src/Interfaces/UniversalInterface.cc
View file @
3bb178a2
...
...
@@ -111,7 +111,7 @@ void UniversalInterface::initBackId( UniSetTypes::ObjectId backid )
// ------------------------------------------------------------------------------------------------------------
/*!
* \param id - идентификатор датчика
*
═
\return текущее значение датчика
*
\return текущее значение датчика
* \exception IOBadParam - генерируется если указано неправильное имя датчика или секции
* \exception IOTimeOut - генерируется если в течение времени timeout небыл получен ответ
*/
...
...
src/Processes/IOController.cc
View file @
3bb178a2
...
...
@@ -101,21 +101,21 @@ CORBA::Long IOController::getValue( const IOController_i::SensorInfo& si )
long
IOController
::
localGetValue
(
IOController
::
IOStateList
::
iterator
&
li
,
const
IOController_i
::
SensorInfo
&
si
)
{
if
(
li
==
ioList
.
end
()
)
li
=
ioList
.
find
(
key
(
si
.
id
,
si
.
node
)
);
if
(
li
==
ioList
.
end
()
)
li
=
ioList
.
find
(
key
(
si
.
id
,
si
.
node
)
);
if
(
li
!=
ioList
.
end
()
)
{
if
(
li
->
second
.
undefined
)
throw
IOController_i
::
Undefined
();
if
(
li
!=
ioList
.
end
()
)
{
if
(
li
->
second
.
undefined
)
throw
IOController_i
::
Undefined
();
uniset_rwmutex_rlock
lock
(
li
->
second
.
val_lock
);
return
li
->
second
.
value
;
}
uniset_rwmutex_rlock
lock
(
li
->
second
.
val_lock
);
return
li
->
second
.
value
;
}
// -------------
ostringstream
err
;
err
<<
myname
<<
"(localGetValue): Not found
analog
sensor ("
<<
si
.
id
<<
":"
<<
si
.
node
<<
") "
err
<<
myname
<<
"(localGetValue): Not found sensor ("
<<
si
.
id
<<
":"
<<
si
.
node
<<
") "
<<
conf
->
oind
->
getNameById
(
si
.
id
);
if
(
unideb
.
debugging
(
Debug
::
INFO
)
)
...
...
@@ -212,7 +212,6 @@ void IOController::localSetValue( IOController::IOStateList::iterator& li,
sup_id
=
getId
();
// сохранение текущего состояния
// IOStateList::iterator li( ioList.end() );
if
(
li
==
ioList
.
end
()
)
li
=
ioList
.
find
(
key
(
si
.
id
,
si
.
node
));
...
...
@@ -300,7 +299,7 @@ IOType IOController::getIOType( const IOController_i::SensorInfo& si )
throw
IOController_i
::
NameNotFound
(
err
.
str
().
c_str
());
}
// ---------------------------------------------------------------------------
void
IOController
::
ioRegistration
(
const
USensorI
OI
nfo
&
ainf
,
bool
force
)
void
IOController
::
ioRegistration
(
const
USensorInfo
&
ainf
,
bool
force
)
{
// проверка задан ли контроллеру идентификатор
if
(
getId
()
==
DefaultObjectId
)
...
...
@@ -435,8 +434,8 @@ void IOController::dumpToDB()
sm
.
sm_tv_sec
=
li
->
second
.
tv_sec
;
sm
.
sm_tv_usec
=
li
->
second
.
tv_usec
;
sm
.
ci
=
li
->
second
.
ci
;
if
(
!
li
->
second
.
db
_
ignore
)
logging
(
sm
);
// alogging( li->second.si,li->second.value,li->second.type );
if
(
!
li
->
second
.
dbignore
)
logging
(
sm
);
}
}
// unlock
}
...
...
@@ -448,17 +447,14 @@ IOController_i::SensorInfoSeq* IOController::getSensorsMap()
IOController_i
::
SensorInfoSeq
*
res
=
new
IOController_i
::
SensorInfoSeq
();
res
->
length
(
ioList
.
size
());
// { // lock
// uniset_mutex_lock lock(ioMutex, 500);
int
i
=
0
;
for
(
IOStateList
::
iterator
it
=
ioList
.
begin
();
it
!=
ioList
.
end
();
++
it
)
{
uniset_rwmutex_rlock
lock
(
it
->
second
.
val_lock
);
(
*
res
)[
i
]
=
it
->
second
;
i
++
;
}
// }
int
i
=
0
;
for
(
IOStateList
::
iterator
it
=
ioList
.
begin
();
it
!=
ioList
.
end
();
++
it
)
{
uniset_rwmutex_rlock
lock
(
it
->
second
.
val_lock
);
(
*
res
)[
i
]
=
it
->
second
;
i
++
;
}
return
res
;
}
// --------------------------------------------------------------------------------------------------------------
...
...
@@ -552,34 +548,34 @@ IOController_i::CalibrateInfo IOController::getCalibrateInfo(const IOController_
<<
conf
->
oind
->
getNameById
(
si
.
id
,
si
.
node
);
throw
IOController_i
::
NameNotFound
(
err
.
str
().
c_str
());
}
return
it
->
second
.
ci
;
return
it
->
second
.
ci
;
}
// --------------------------------------------------------------------------------------------------------------
IOController
::
USensorI
OInfo
::
USensorIO
Info
(
IOController_i
::
SensorIOInfo
&
ai
)
:
IOController
::
USensorI
nfo
::
USensor
Info
(
IOController_i
::
SensorIOInfo
&
ai
)
:
IOController_i
::
SensorIOInfo
(
ai
),
any
(
0
)
{}
IOController
::
USensorI
OInfo
::
USensorIO
Info
(
const
IOController_i
::
SensorIOInfo
&
ai
)
:
IOController
::
USensorI
nfo
::
USensor
Info
(
const
IOController_i
::
SensorIOInfo
&
ai
)
:
IOController_i
::
SensorIOInfo
(
ai
),
any
(
0
)
{}
IOController
::
USensorI
OInfo
::
USensorIO
Info
(
IOController_i
::
SensorIOInfo
*
ai
)
:
IOController
::
USensorI
nfo
::
USensor
Info
(
IOController_i
::
SensorIOInfo
*
ai
)
:
IOController_i
::
SensorIOInfo
(
*
ai
),
any
(
0
)
{}
IOController
::
USensorI
OI
nfo
&
IOController
::
USensorI
OI
nfo
::
operator
=
(
IOController_i
::
SensorIOInfo
&
r
)
IOController
::
USensorInfo
&
IOController
::
USensorInfo
::
operator
=
(
IOController_i
::
SensorIOInfo
&
r
)
{
(
*
this
)
=
r
;
// any=0;
return
*
this
;
}
IOController
::
USensorI
OI
nfo
&
IOController
::
USensorI
OI
nfo
::
operator
=
(
IOController_i
::
SensorIOInfo
*
r
)
IOController
::
USensorInfo
&
IOController
::
USensorInfo
::
operator
=
(
IOController_i
::
SensorIOInfo
*
r
)
{
(
*
this
)
=
(
*
r
);
// any=0;
...
...
@@ -587,8 +583,8 @@ IOController::USensorIOInfo&
return
*
this
;
}
const
IOController
::
USensorI
OI
nfo
&
IOController
::
USensorI
OI
nfo
::
operator
=
(
const
IOController_i
::
SensorIOInfo
&
r
)
const
IOController
::
USensorInfo
&
IOController
::
USensorInfo
::
operator
=
(
const
IOController_i
::
SensorIOInfo
&
r
)
{
(
*
this
)
=
r
;
// any=0;
...
...
@@ -596,7 +592,7 @@ const IOController::USensorIOInfo&
}
// ----------------------------------------------------------------------------------------
bool
IOController
::
checkIOFilters
(
const
USensorI
OI
nfo
&
ai
,
CORBA
::
Long
&
newvalue
,
bool
IOController
::
checkIOFilters
(
const
USensorInfo
&
ai
,
CORBA
::
Long
&
newvalue
,
UniSetTypes
::
ObjectId
sup_id
)
{
for
(
IOFilterSlotList
::
iterator
it
=
iofilters
.
begin
();
it
!=
iofilters
.
end
();
++
it
)
...
...
@@ -794,7 +790,7 @@ IOController::ChangeUndefinedStateSignal IOController::signal_change_undefined_s
return
sigAnyUndefChange
;
}
// -----------------------------------------------------------------------------
void
IOController
::
USensorI
OI
nfo
::
checkDepend
(
IOStateList
::
iterator
&
d_it
,
IOController
*
ic
)
void
IOController
::
USensorInfo
::
checkDepend
(
IOStateList
::
iterator
&
d_it
,
IOController
*
ic
)
{
bool
changed
=
false
;
{
...
...
src/Processes/IONotifyController.cc
View file @
3bb178a2
...
...
@@ -309,7 +309,7 @@ void IONotifyController::ask(AskMap& askLst, const IOController_i::SensorInfo& s
}
}
// ------------------------------------------------------------------------------------------
bool
IONotifyController
::
myIOFilter
(
const
USensorI
OI
nfo
&
ai
,
bool
IONotifyController
::
myIOFilter
(
const
USensorInfo
&
ai
,
CORBA
::
Long
newvalue
,
UniSetTypes
::
ObjectId
sup_id
)
{
if
(
ai
.
value
==
newvalue
)
...
...
@@ -368,7 +368,7 @@ void IONotifyController::localSetValue( IOController::IOStateList::iterator& li,
try
{
if
(
!
li
->
second
.
db
_
ignore
)
if
(
!
li
->
second
.
dbignore
)
loggingInfo
(
sm
);
}
catch
(...){}
...
...
@@ -923,7 +923,7 @@ IONotifyController_i::ThresholdsListSeq* IONotifyController::getThresholdsList()
// -----------------------------------------------------------------------------
void
IONotifyController
::
onChangeUndefinedState
(
IOStateList
::
iterator
&
lit
,
IOController
*
ic
)
{
USensorI
OI
nfo
&
it
(
lit
->
second
);
USensorInfo
&
it
(
lit
->
second
);
SensorMessage
sm
;
...
...
@@ -945,7 +945,7 @@ void IONotifyController::onChangeUndefinedState( IOStateList::iterator& lit, IOC
try
{
if
(
!
it
.
db
_
ignore
)
if
(
!
it
.
dbignore
)
loggingInfo
(
sm
);
}
catch
(...){}
...
...
src/Processes/NCRestorer.cc
View file @
3bb178a2
...
...
@@ -171,10 +171,14 @@ NCRestorer::SInfo& NCRestorer::SInfo::operator=(IOController_i::SensorIOInfo& in
this
->
default_val
=
inf
.
default_val
;
this
->
real_value
=
inf
.
real_value
;
this
->
ci
=
inf
.
ci
;
this
->
undefined
=
false
;
this
->
db_ignore
=
false
;
this
->
undefined
=
inf
.
undefined
;
this
->
blocked
=
inf
.
blocked
;
this
->
dbignore
=
inf
.
dbignore
;
this
->
any
=
0
;
return
*
this
;
// CalibrateInfo ci;
// long tv_sec;
// long v_usec;
}
// ------------------------------------------------------------------------------------------
void
NCRestorer
::
init_depends_signals
(
IONotifyController
*
ic
)
...
...
@@ -190,11 +194,11 @@ void NCRestorer::init_depends_signals( IONotifyController* ic )
if
(
unideb
.
debugging
(
Debug
::
INFO
)
)
unideb
[
Debug
::
INFO
]
<<
ic
->
getName
()
<<
"(NCRestorer::init_depends_signals): "
<<
" init depend: '"
<<
conf
->
oind
->
getMapName
(
it
->
second
.
si
.
id
)
<<
"'"
<<
" dep_name='"
<<
conf
->
oind
->
getMapName
(
it
->
second
.
d_si
.
id
)
<<
"'"
<<
" dep_name=
("
<<
it
->
second
.
d_si
.
id
<<
")
'"
<<
conf
->
oind
->
getMapName
(
it
->
second
.
d_si
.
id
)
<<
"'"
<<
endl
;
IOController
::
ChangeSignal
s
=
ic
->
signal_change_value
(
it
->
second
.
d_si
);
s
.
connect
(
sigc
::
mem_fun
(
&
it
->
second
,
&
IOController
::
USensorI
OI
nfo
::
checkDepend
)
);
s
.
connect
(
sigc
::
mem_fun
(
&
it
->
second
,
&
IOController
::
USensorInfo
::
checkDepend
)
);
}
}
// -----------------------------------------------------------------------------
src/Processes/NCRestorer_XML.cc
View file @
3bb178a2
...
...
@@ -303,7 +303,7 @@ bool NCRestorer_XML::getSensorInfo( UniXML& xml, xmlNode* it, SInfo& inf )
}
inf
.
default_val
=
xml
.
getIntProp
(
it
,
"default"
);
inf
.
db
_
ignore
=
xml
.
getIntProp
(
it
,
"dbignore"
);
inf
.
dbignore
=
xml
.
getIntProp
(
it
,
"dbignore"
);
inf
.
value
=
inf
.
default_val
;
inf
.
undefined
=
false
;
inf
.
real_value
=
inf
.
value
;
...
...
tests/ui.cc
View file @
3bb178a2
...
...
@@ -35,7 +35,6 @@ int main( int argc, const char **argv )
cerr
<<
"unknown sensor ID. Use --sid "
<<
endl
;
return
1
;
}
cout
<<
"** check getChangedTime for ID="
<<
id
<<
":"
<<
endl
;
...
...
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