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
32852a64
Commit
32852a64
authored
Nov 11, 2014
by
Aleksey Vinogradov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
еще правки в unet для возможности наследования
parent
6700fc00
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
86 additions
and
30 deletions
+86
-30
UNetExchange.h
extensions/UNetUDP/UNetExchange.h
+1
-1
UNetReceiver.cc
extensions/UNetUDP/UNetReceiver.cc
+54
-1
UNetReceiver.h
extensions/UNetUDP/UNetReceiver.h
+25
-23
UNetSender.h
extensions/UNetUDP/UNetSender.h
+6
-5
No files found.
extensions/UNetUDP/UNetExchange.h
View file @
32852a64
...
...
@@ -95,6 +95,7 @@ class UNetExchange:
/*! игнорировать запись датчика в SM */
void
ignore_item
(
UniSetTypes
::
ObjectId
id
=
UniSetTypes
::
DefaultObjectId
,
bool
set
=
true
);
protected
:
UNetExchange
();
xmlNode
*
cnode
;
std
::
string
s_field
;
...
...
@@ -129,7 +130,6 @@ class UNetExchange:
};
private
:
UNetExchange
();
bool
initPause
;
UniSetTypes
::
uniset_mutex
mutex_start
;
...
...
extensions/UNetUDP/UNetReceiver.cc
View file @
32852a64
...
...
@@ -366,7 +366,60 @@ void UNetReceiver::real_update()
}
}
}
// -----------------------------------------------------------------------------
void
UNetReceiver
::
updateDItem
(
ItemInfo
&
ii
,
const
long
&
id
,
bool
val
)
{
try
{
if
(
ii
.
iotype
==
UniversalIO
::
DigitalInput
)
shm
->
localSaveState
(
ii
.
dit
,
id
,
val
,
shm
->
ID
());
else
if
(
ii
.
iotype
==
UniversalIO
::
AnalogInput
)
shm
->
localSaveValue
(
ii
.
ait
,
id
,
val
,
shm
->
ID
());
else
if
(
ii
.
iotype
==
UniversalIO
::
AnalogOutput
)
shm
->
localSetValue
(
ii
.
ait
,
id
,
val
,
shm
->
ID
());
else
if
(
ii
.
iotype
==
UniversalIO
::
DigitalOutput
)
shm
->
localSetState
(
ii
.
dit
,
id
,
val
,
shm
->
ID
());
else
dlog
[
Debug
::
CRIT
]
<<
myname
<<
"(updateAItem): Unknown iotype for sid="
<<
id
<<
endl
;
}
catch
(
UniSetTypes
::
Exception
&
ex
)
{
dlog
[
Debug
::
CRIT
]
<<
myname
<<
"(updateAItem): "
<<
ex
<<
std
::
endl
;
throw
ex
;
}
catch
(...)
{
dlog
[
Debug
::
CRIT
]
<<
myname
<<
"(updateAItem): catch ..."
<<
std
::
endl
;
throw
;
}
}
// -----------------------------------------------------------------------------
void
UNetReceiver
::
updateAItem
(
ItemInfo
&
ii
,
const
UniSetUDP
::
UDPAData
&
d
)
{
try
{
if
(
ii
.
iotype
==
UniversalIO
::
DigitalInput
)
shm
->
localSaveState
(
ii
.
dit
,
d
.
id
,
d
.
val
,
shm
->
ID
());
else
if
(
ii
.
iotype
==
UniversalIO
::
AnalogInput
)
shm
->
localSaveValue
(
ii
.
ait
,
d
.
id
,
d
.
val
,
shm
->
ID
());
else
if
(
ii
.
iotype
==
UniversalIO
::
AnalogOutput
)
shm
->
localSetValue
(
ii
.
ait
,
d
.
id
,
d
.
val
,
shm
->
ID
());
else
if
(
ii
.
iotype
==
UniversalIO
::
DigitalOutput
)
shm
->
localSetState
(
ii
.
dit
,
d
.
id
,
d
.
val
,
shm
->
ID
());
else
dlog
[
Debug
::
CRIT
]
<<
myname
<<
"(updateAItem): Unknown iotype for sid="
<<
d
.
id
<<
endl
;
}
catch
(
UniSetTypes
::
Exception
&
ex
)
{
dlog
[
Debug
::
CRIT
]
<<
myname
<<
"(updateAItem): "
<<
ex
<<
std
::
endl
;
throw
ex
;
}
catch
(...)
{
dlog
[
Debug
::
CRIT
]
<<
myname
<<
"(updateAItem): catch ..."
<<
std
::
endl
;
throw
;
}
}
// -----------------------------------------------------------------------------
void
UNetReceiver
::
stop
()
{
...
...
extensions/UNetUDP/UNetReceiver.h
View file @
32852a64
...
...
@@ -97,6 +97,7 @@ class UNetReceiver
void
ignore_item
(
UniSetTypes
::
ObjectId
id
=
UniSetTypes
::
DefaultObjectId
,
bool
set
=
true
);
protected
:
UNetReceiver
();
SMInterface
*
shm
;
...
...
@@ -104,10 +105,33 @@ class UNetReceiver
void
step
();
virtual
void
real_update
();
std
::
string
myname
;
struct
ItemInfo
{
long
id
;
IOController
::
AIOStateList
::
iterator
ait
;
IOController
::
DIOStateList
::
iterator
dit
;
UniversalIO
::
IOTypes
iotype
;
bool
ignore
;
/*!< флаг игнорирования сохранения в SM*/
ItemInfo
()
:
id
(
UniSetTypes
::
DefaultObjectId
),
iotype
(
UniversalIO
::
UnknownIOType
),
ignore
(
false
){}
};
virtual
void
updateDItem
(
ItemInfo
&
ii
,
const
long
&
id
,
bool
val
);
virtual
void
updateAItem
(
ItemInfo
&
ii
,
const
UniSetUDP
::
UDPAData
&
d
);
void
initIterators
();
typedef
std
::
vector
<
ItemInfo
>
ItemVec
;
ItemVec
d_icache
;
/*!< кэш итераторов для булевых */
ItemVec
a_icache
;
/*!< кэш итераторов для аналоговых */
bool
d_cache_init_ok
;
bool
a_cache_init_ok
;
private
:
UNetReceiver
();
int
recvpause
;
/*!< пауза меджду приёмами пакетов, [мсек] */
int
updatepause
;
/*!< переодичность обновления данных в SM, [мсек] */
...
...
@@ -115,7 +139,6 @@ class UNetReceiver
ost
::
UDPReceive
*
udp
;
ost
::
IPV4Address
addr
;
ost
::
tpport_t
port
;
std
::
string
myname
;
UniSetTypes
::
uniset_mutex
pollMutex
;
PassiveTimer
ptRecvTimeout
;
...
...
@@ -170,27 +193,6 @@ class UNetReceiver
Trigger
trTimeout
;
UniSetTypes
::
uniset_mutex
tmMutex
;
struct
ItemInfo
{
long
id
;
IOController
::
AIOStateList
::
iterator
ait
;
IOController
::
DIOStateList
::
iterator
dit
;
UniversalIO
::
IOTypes
iotype
;
bool
ignore
;
/*!< флаг игнорирования сохранения в SM*/
ItemInfo
()
:
id
(
UniSetTypes
::
DefaultObjectId
),
iotype
(
UniversalIO
::
UnknownIOType
),
ignore
(
false
){}
};
typedef
std
::
vector
<
ItemInfo
>
ItemVec
;
ItemVec
d_icache
;
/*!< кэш итераторов для булевых */
ItemVec
a_icache
;
/*!< кэш итераторов для аналоговых */
bool
d_cache_init_ok
;
bool
a_cache_init_ok
;
virtual
void
initDCache
(
UniSetUDP
::
UDPMessage
&
pack
,
bool
force
=
false
);
virtual
void
initACache
(
UniSetUDP
::
UDPMessage
&
pack
,
bool
force
=
false
);
};
...
...
extensions/UNetUDP/UNetSender.h
View file @
32852a64
...
...
@@ -66,7 +66,13 @@ class UNetSender
void
initIterators
();
protected
:
UNetSender
();
std
::
string
myname
;
UniSetUDP
::
UDPMessage
mypack
;
DMap
dlist
;
int
maxItem
;
std
::
string
s_field
;
std
::
string
s_fvalue
;
...
...
@@ -78,21 +84,16 @@ class UNetSender
virtual
void
readConfiguration
();
private
:
UNetSender
();
ost
::
UDPBroadcast
*
udp
;
ost
::
IPV4Address
addr
;
ost
::
tpport_t
port
;
std
::
string
s_host
;
std
::
string
myname
;
int
sendpause
;
bool
activated
;
UniSetTypes
::
uniset_mutex
pack_mutex
;
UniSetUDP
::
UDPMessage
mypack
;
DMap
dlist
;
int
maxItem
;
unsigned
long
packetnum
;
UniSetUDP
::
UDPPacket
s_msg
;
...
...
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