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
070f1f5b
Commit
070f1f5b
authored
Aug 01, 2016
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Расставляю const потихоньку
parent
60689442
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
63 changed files
with
315 additions
and
314 deletions
+315
-314
ctl-cpp-common.xsl
Utilities/codegen/ctl-cpp-common.xsl
+6
-6
ComediInterface.h
extensions/IOControl/ComediInterface.h
+1
-2
IOControl.h
extensions/IOControl/IOControl.h
+12
-15
Element.cc
extensions/LogicProcessor/Element.cc
+3
-3
Element.h
extensions/LogicProcessor/Element.h
+25
-26
LProcessor.h
extensions/LogicProcessor/LProcessor.h
+2
-2
TAND.cc
extensions/LogicProcessor/TAND.cc
+2
-2
TDelay.cc
extensions/LogicProcessor/TDelay.cc
+3
-3
TDelay.h
extensions/LogicProcessor/TDelay.h
+4
-5
TNOT.cc
extensions/LogicProcessor/TNOT.cc
+1
-1
TOR.cc
extensions/LogicProcessor/TOR.cc
+2
-2
MBExchange.cc
extensions/ModbusMaster/MBExchange.cc
+13
-13
MBExchange.h
extensions/ModbusMaster/MBExchange.h
+2
-2
MBTCPMultiMaster.cc
extensions/ModbusMaster/MBTCPMultiMaster.cc
+1
-1
MBTCPMultiMaster.h
extensions/ModbusMaster/MBTCPMultiMaster.h
+1
-1
UDPPacket.cc
extensions/UNetUDP/UDPPacket.cc
+1
-1
UDPPacket.h
extensions/UNetUDP/UDPPacket.h
+1
-1
MTR.h
extensions/include/MTR.h
+25
-25
UObject_SK.h
extensions/include/UObject_SK.h
+3
-3
VTypes.h
extensions/include/VTypes.h
+23
-23
MTR.cc
extensions/lib/MTR.cc
+1
-1
UObject_SK.cc
extensions/lib/UObject_SK.cc
+3
-3
EventLoopServer.h
include/EventLoopServer.h
+1
-1
HourGlass.h
include/HourGlass.h
+4
-4
LogSession.h
include/LogSession.h
+6
-11
MQAtomic.h
include/MQAtomic.h
+3
-3
MQMutex.h
include/MQMutex.h
+1
-1
ObjectIndex.h
include/ObjectIndex.h
+9
-9
ObjectIndex_Array.h
include/ObjectIndex_Array.h
+8
-8
ObjectIndex_XML.h
include/ObjectIndex_XML.h
+8
-8
ObjectIndex_idXML.h
include/ObjectIndex_idXML.h
+6
-6
Restorer.h
include/Restorer.h
+0
-1
Trigger.h
include/Trigger.h
+1
-1
TriggerAND.h
include/TriggerAND.h
+2
-2
TriggerAND.tcc
include/TriggerAND.tcc
+2
-2
TriggerOR.h
include/TriggerOR.h
+2
-2
TriggerOR.tcc
include/TriggerOR.tcc
+3
-3
TriggerOUT.h
include/TriggerOUT.h
+1
-1
TriggerOUT.tcc
include/TriggerOUT.tcc
+1
-1
UDPCore.h
include/UDPCore.h
+1
-1
UniSetActivator.h
include/UniSetActivator.h
+1
-1
UniXML.h
include/UniXML.h
+2
-2
ModbusClient.h
include/modbus/ModbusClient.h
+1
-2
ModbusRTUSlave.h
include/modbus/ModbusRTUSlave.h
+1
-1
ModbusServer.h
include/modbus/ModbusServer.h
+4
-4
ModbusTCPMaster.h
include/modbus/ModbusTCPMaster.h
+3
-3
ModbusTCPServer.h
include/modbus/ModbusTCPServer.h
+1
-1
ModbusTCPSession.h
include/modbus/ModbusTCPSession.h
+2
-2
ModbusTypes.h
include/modbus/ModbusTypes.h
+40
-36
ModbusRTUSlave.cc
src/Communications/Modbus/ModbusRTUSlave.cc
+1
-1
ModbusTCPMaster.cc
src/Communications/Modbus/ModbusTCPMaster.cc
+1
-1
ModbusTCPServer.cc
src/Communications/Modbus/ModbusTCPServer.cc
+1
-1
ModbusTCPSession.cc
src/Communications/Modbus/ModbusTCPSession.cc
+1
-1
ModbusTypes.cc
src/Communications/Modbus/ModbusTypes.cc
+23
-23
LogSession.cc
src/Log/LogSession.cc
+11
-1
ObjectIndex.cc
src/ObjectRepository/ObjectIndex.cc
+1
-1
ObjectIndex_Array.cc
src/ObjectRepository/ObjectIndex_Array.cc
+6
-6
ObjectIndex_XML.cc
src/ObjectRepository/ObjectIndex_XML.cc
+9
-9
ObjectIndex_idXML.cc
src/ObjectRepository/ObjectIndex_idXML.cc
+6
-6
EventLoopServer.cc
src/Processes/EventLoopServer.cc
+1
-1
LT_Object.cc
src/Various/LT_Object.cc
+1
-1
MQAtomic.cc
src/Various/MQAtomic.cc
+3
-3
MQMutex.cc
src/Various/MQMutex.cc
+1
-1
No files found.
Utilities/codegen/ctl-cpp-common.xsl
View file @
070f1f5b
...
...
@@ -237,13 +237,13 @@
\param id - идентификатор датчика
\param showLinkName - TRUE - выводить SensorName, FALSE - не выводить
*/
std::string str( UniSetTypes::ObjectId id, bool showLinkName=true );
std::string str( UniSetTypes::ObjectId id, bool showLinkName=true )
const
;
/*! Вывод значения входа/выхода в формате: in_xxx(SensorName)=val
\param id - идентификатор датчика
\param showLinkName - TRUE - выводить SensorName, FALSE - не выводить
*/
std::string strval( UniSetTypes::ObjectId id, bool showLinkName=true );
std::string strval( UniSetTypes::ObjectId id, bool showLinkName=true )
const
;
/*! Вывод состояния внутренних переменных */
inline std::string dumpVars(){ return std::move(vmon.pretty_str()); }
...
...
@@ -1184,7 +1184,7 @@ std::string <xsl:value-of select="$CLASSNAME"/>_SK::dumpIO()
return std::move(s.str());
}
// ----------------------------------------------------------------------------
std::string
<xsl:value-of
select=
"$CLASSNAME"
/>
_SK::str( UniSetTypes::ObjectId id, bool showLinkName )
std::string
<xsl:value-of
select=
"$CLASSNAME"
/>
_SK::str( UniSetTypes::ObjectId id, bool showLinkName )
const
{
ostringstream s;
<xsl:for-each
select=
"//smap/item"
>
...
...
@@ -1198,7 +1198,7 @@ std::string <xsl:value-of select="$CLASSNAME"/>_SK::str( UniSetTypes::ObjectId
return "";
}
// ----------------------------------------------------------------------------
std::string
<xsl:value-of
select=
"$CLASSNAME"
/>
_SK::strval( UniSetTypes::ObjectId id, bool showLinkName )
std::string
<xsl:value-of
select=
"$CLASSNAME"
/>
_SK::strval( UniSetTypes::ObjectId id, bool showLinkName )
const
{
ostringstream s;
<xsl:for-each
select=
"//smap/item"
>
...
...
@@ -1511,7 +1511,7 @@ std::string <xsl:value-of select="$CLASSNAME"/>_SK::dumpIO()
return std::move(s.str());
}
// ----------------------------------------------------------------------------
std::string
<xsl:value-of
select=
"$CLASSNAME"
/>
_SK::str( UniSetTypes::ObjectId id, bool showLinkName )
std::string
<xsl:value-of
select=
"$CLASSNAME"
/>
_SK::str( UniSetTypes::ObjectId id, bool showLinkName )
const
{
ostringstream s;
<xsl:for-each
select=
"//sensors/item/consumers/consumer"
>
...
...
@@ -1529,7 +1529,7 @@ std::string <xsl:value-of select="$CLASSNAME"/>_SK::str( UniSetTypes::ObjectId
return "";
}
// ----------------------------------------------------------------------------
std::string
<xsl:value-of
select=
"$CLASSNAME"
/>
_SK::strval( UniSetTypes::ObjectId id, bool showLinkName )
std::string
<xsl:value-of
select=
"$CLASSNAME"
/>
_SK::strval( UniSetTypes::ObjectId id, bool showLinkName ) const
{
ostringstream s;
<xsl:for-each
select=
"//sensors/item/consumers/consumer"
>
...
...
extensions/IOControl/ComediInterface.h
View file @
070f1f5b
...
...
@@ -62,8 +62,7 @@ class ComediInterface
static
std
::
string
type2str
(
SubdevType
t
);
static
SubdevType
str2type
(
const
std
::
string
&
s
);
void
configureSubdev
(
int
subdev
,
SubdevType
type
)
throw
(
UniSetTypes
::
Exception
);
void
configureSubdev
(
int
subdev
,
SubdevType
type
)
throw
(
UniSetTypes
::
Exception
);
void
configureChannel
(
int
subdev
,
int
channel
,
ChannelType
type
,
int
range
=
0
,
int
aref
=
0
)
throw
(
UniSetTypes
::
Exception
);
...
...
extensions/IOControl/IOControl.h
View file @
070f1f5b
...
...
@@ -186,15 +186,15 @@ class CardList:
{
public
:
explicit
CardList
(
int
size
)
:
std
::
vector
<
ComediInterface
*
>
(
size
)
{
}
explicit
CardList
(
size_t
size
)
:
std
::
vector
<
ComediInterface
*
>
(
size
)
{
}
~
CardList
()
{
for
(
unsigned
in
t
i
=
0
;
i
<
size
();
i
++
)
for
(
size_
t
i
=
0
;
i
<
size
();
i
++
)
delete
(
*
this
)[
i
];
}
inline
ComediInterface
*
getCard
(
int
ncard
)
inline
ComediInterface
*
getCard
(
int
ncard
)
const
{
if
(
ncard
>=
0
&&
ncard
<
(
int
)
size
()
)
return
(
*
this
)[
ncard
];
...
...
@@ -258,7 +258,7 @@ class IOControl:
int
subdev
;
/*!< (UNIO) подустройство (см. comedi_test для конкретной карты в/в) */
int
channel
;
/*!< (UNIO) канал [0...23] */
int
ncard
;
/*!< номер карты [1|2].
0 - не определена. FIXME from Lav: -1 - не определена?
*/
int
ncard
;
/*!< номер карты [1|2].
-1 - не определена.
*/
/*! Вид поключения
0 - analog ref = analog ground
...
...
@@ -286,21 +286,21 @@ class IOControl:
struct
IOPriority
{
IOPriority
(
int
p
,
in
t
i
)
:
IOPriority
(
size_t
p
,
size_
t
i
)
:
priority
(
p
),
index
(
i
)
{}
int
priority
;
in
t
index
;
size_t
priority
;
size_
t
index
;
};
enum
TestModeID
{
tmNone
=
0
,
/*!< тестовый режим отключён */
tmNone
=
0
,
/*!< тестовый режим отключён */
tmOffPoll
=
1
,
/*!< отключить опрос */
tmConfigEnable
=
2
,
/*!< специальный режим, в соответс
вии с настройкой 'enable_testmode' */
tmConfigDisable
=
3
,
/*!< специальный режим, в соответс
вии с настройкой 'disable_testmode' */
tmConfigEnable
=
2
,
/*!< специальный режим, в соответст
вии с настройкой 'enable_testmode' */
tmConfigDisable
=
3
,
/*!< специальный режим, в соответст
вии с настройкой 'disable_testmode' */
tmOnlyInputs
=
4
,
/*!< включены только входы */
tmOnlyOutputs
=
5
/*!< включены только выходы */
tmOnlyOutputs
=
5
/*!< включены только выходы */
};
void
execute
();
...
...
@@ -335,8 +335,6 @@ class IOControl:
void
waitSM
();
bool
checkCards
(
const
std
::
string
&
func
=
""
);
xmlNode
*
cnode
=
{
0
};
/*!< xml-узел в настроечном файле */
int
polltime
=
{
150
};
/*!< переодичность обновления данных (опроса карт в/в), [мсек] */
...
...
@@ -403,8 +401,7 @@ class IOControl:
bool
readconf_ok
=
{
false
};
int
activateTimeout
;
UniSetTypes
::
ObjectId
sidTestSMReady
=
{
UniSetTypes
::
DefaultObjectId
};
bool
term
=
{
false
};
std
::
atomic_bool
term
=
{
false
};
UniSetTypes
::
ObjectId
testMode_as
=
{
UniSetTypes
::
DefaultObjectId
};
IOController
::
IOStateList
::
iterator
itTestMode
;
...
...
extensions/LogicProcessor/Element.cc
View file @
070f1f5b
...
...
@@ -23,7 +23,7 @@ using namespace std;
const
Element
::
ElementID
Element
::
DefaultElementID
=
"?id?"
;
// -------------------------------------------------------------------------
void
Element
::
addChildOut
(
std
::
shared_ptr
<
Element
>
el
,
in
t
num
)
void
Element
::
addChildOut
(
std
::
shared_ptr
<
Element
>
el
,
size_
t
num
)
{
if
(
el
.
get
()
==
this
)
{
...
...
@@ -90,7 +90,7 @@ std::shared_ptr<Element> Element::find(const ElementID& id )
return
nullptr
;
}
// -------------------------------------------------------------------------
void
Element
::
addInput
(
in
t
num
,
bool
state
)
void
Element
::
addInput
(
size_
t
num
,
bool
state
)
{
for
(
auto
&
it
:
ins
)
{
...
...
@@ -105,7 +105,7 @@ void Element::addInput(int num, bool state)
ins
.
push_front
(
InputInfo
(
num
,
state
));
}
// -------------------------------------------------------------------------
void
Element
::
delInput
(
in
t
num
)
void
Element
::
delInput
(
size_
t
num
)
{
for
(
auto
it
=
ins
.
begin
();
it
!=
ins
.
end
();
++
it
)
{
...
...
extensions/LogicProcessor/Element.h
View file @
070f1f5b
...
...
@@ -57,30 +57,30 @@ class Element
*/
virtual
void
tick
()
{}
virtual
void
setIn
(
in
t
num
,
bool
state
)
=
0
;
virtual
bool
getOut
()
=
0
;
virtual
void
setIn
(
size_
t
num
,
bool
state
)
=
0
;
virtual
bool
getOut
()
const
=
0
;
inline
ElementID
getId
()
inline
ElementID
getId
()
const
{
return
myid
;
}
virtual
std
::
string
getType
()
virtual
std
::
string
getType
()
const
{
return
"?type?"
;
}
virtual
std
::
shared_ptr
<
Element
>
find
(
const
ElementID
&
id
);
virtual
void
addChildOut
(
std
::
shared_ptr
<
Element
>
el
,
in
t
in_num
);
virtual
void
addChildOut
(
std
::
shared_ptr
<
Element
>
el
,
size_
t
in_num
);
virtual
void
delChildOut
(
std
::
shared_ptr
<
Element
>
el
);
inline
int
outCount
()
inline
size_t
outCount
()
const
{
return
outs
.
size
();
}
virtual
void
addInput
(
in
t
num
,
bool
state
=
false
);
virtual
void
delInput
(
in
t
num
);
inline
int
inCount
()
virtual
void
addInput
(
size_
t
num
,
bool
state
=
false
);
virtual
void
delInput
(
size_
t
num
);
inline
size_t
inCount
()
const
{
return
ins
.
size
();
}
...
...
@@ -103,24 +103,23 @@ class Element
struct
ChildInfo
{
ChildInfo
(
std
::
shared_ptr
<
Element
>
e
,
in
t
n
)
:
ChildInfo
(
std
::
shared_ptr
<
Element
>
e
,
size_
t
n
)
:
el
(
e
),
num
(
n
)
{}
ChildInfo
()
:
el
(
0
),
num
(
0
)
{}
std
::
shared_ptr
<
Element
>
el
;
in
t
num
;
size_
t
num
;
};
typedef
std
::
list
<
ChildInfo
>
OutputList
;
OutputList
outs
;
virtual
void
setChildOut
();
struct
InputInfo
{
InputInfo
()
:
num
(
0
),
state
(
false
),
type
(
unknown
)
{}
InputInfo
(
in
t
n
,
bool
s
)
:
num
(
n
),
state
(
s
),
type
(
unknown
)
{}
in
t
num
;
InputInfo
(
size_
t
n
,
bool
s
)
:
num
(
n
),
state
(
s
),
type
(
unknown
)
{}
size_
t
num
;
bool
state
;
InputType
type
;
};
...
...
@@ -140,16 +139,16 @@ class TOR:
{
public
:
TOR
(
ElementID
id
,
unsigned
in
t
numbers
=
0
,
bool
st
=
false
);
TOR
(
ElementID
id
,
size_
t
numbers
=
0
,
bool
st
=
false
);
virtual
~
TOR
();
virtual
void
setIn
(
in
t
num
,
bool
state
)
override
;
virtual
bool
getOut
()
override
virtual
void
setIn
(
size_
t
num
,
bool
state
)
override
;
virtual
bool
getOut
()
const
override
{
return
myout
;
}
virtual
std
::
string
getType
()
override
virtual
std
::
string
getType
()
const
override
{
return
"OR"
;
}
...
...
@@ -167,11 +166,11 @@ class TAND:
{
public
:
TAND
(
ElementID
id
,
in
t
numbers
=
0
,
bool
st
=
false
);
TAND
(
ElementID
id
,
size_
t
numbers
=
0
,
bool
st
=
false
);
virtual
~
TAND
();
virtual
void
setIn
(
in
t
num
,
bool
state
)
override
;
virtual
std
::
string
getType
()
override
virtual
void
setIn
(
size_
t
num
,
bool
state
)
override
;
virtual
std
::
string
getType
()
const
override
{
return
"AND"
;
}
...
...
@@ -192,20 +191,20 @@ class TNOT:
TNOT
(
ElementID
id
,
bool
out_default
);
virtual
~
TNOT
();
virtual
bool
getOut
()
override
virtual
bool
getOut
()
const
override
{
return
myout
;
}
/* num игнорируется, т.к. элемент с одним входом
*/
virtual
void
setIn
(
in
t
num
,
bool
state
)
override
;
virtual
std
::
string
getType
()
override
virtual
void
setIn
(
size_
t
num
,
bool
state
)
override
;
virtual
std
::
string
getType
()
const
override
{
return
"NOT"
;
}
virtual
void
addInput
(
in
t
num
,
bool
state
=
false
)
override
{}
virtual
void
delInput
(
in
t
num
)
override
{}
virtual
void
addInput
(
size_
t
num
,
bool
state
=
false
)
override
{}
virtual
void
delInput
(
size_
t
num
)
override
{}
protected
:
TNOT
()
:
myout
(
false
)
{}
...
...
extensions/LogicProcessor/LProcessor.h
View file @
070f1f5b
...
...
@@ -116,7 +116,7 @@ class LProcessor
void
open
(
const
std
::
string
&
lfile
);
inline
bool
isOpen
()
inline
bool
isOpen
()
const
{
return
!
fSchema
.
empty
();
}
...
...
@@ -133,7 +133,7 @@ class LProcessor
return
sch
;
}
inline
int
getSleepTime
()
inline
int
getSleepTime
()
const
{
return
sleepTime
;
}
...
...
extensions/LogicProcessor/TAND.cc
View file @
070f1f5b
...
...
@@ -21,7 +21,7 @@
using
namespace
std
;
using
namespace
UniSetExtensions
;
// -------------------------------------------------------------------------
TAND
::
TAND
(
ElementID
id
,
in
t
num
,
bool
st
)
:
TAND
::
TAND
(
ElementID
id
,
size_
t
num
,
bool
st
)
:
TOR
(
id
,
num
,
st
)
{
}
...
...
@@ -30,7 +30,7 @@ TAND::~TAND()
{
}
// -------------------------------------------------------------------------
void
TAND
::
setIn
(
in
t
num
,
bool
state
)
void
TAND
::
setIn
(
size_
t
num
,
bool
state
)
{
// cout << this << ": input " << num << " set " << state << endl;
for
(
auto
&
it
:
ins
)
...
...
extensions/LogicProcessor/TDelay.cc
View file @
070f1f5b
...
...
@@ -21,7 +21,7 @@
using
namespace
std
;
using
namespace
UniSetExtensions
;
// -------------------------------------------------------------------------
TDelay
::
TDelay
(
Element
::
ElementID
id
,
timeout_t
delayMS
,
unsigned
in
t
inCount
)
:
TDelay
::
TDelay
(
Element
::
ElementID
id
,
timeout_t
delayMS
,
size_
t
inCount
)
:
Element
(
id
),
myout
(
false
),
delay
(
delayMS
)
...
...
@@ -38,7 +38,7 @@ TDelay::~TDelay()
{
}
// -------------------------------------------------------------------------
void
TDelay
::
setIn
(
in
t
num
,
bool
state
)
void
TDelay
::
setIn
(
size_
t
num
,
bool
state
)
{
bool
prev
=
myout
;
...
...
@@ -89,7 +89,7 @@ void TDelay::tick()
}
}
// -------------------------------------------------------------------------
bool
TDelay
::
getOut
()
bool
TDelay
::
getOut
()
const
{
return
myout
;
}
...
...
extensions/LogicProcessor/TDelay.h
View file @
070f1f5b
...
...
@@ -27,14 +27,13 @@ class TDelay:
{
public
:
TDelay
(
Element
::
ElementID
id
,
timeout_t
delayMS
=
0
,
unsigned
in
t
inCount
=
0
);
TDelay
(
Element
::
ElementID
id
,
timeout_t
delayMS
=
0
,
size_
t
inCount
=
0
);
virtual
~
TDelay
();
virtual
void
tick
()
override
;
virtual
void
setIn
(
in
t
num
,
bool
state
)
override
;
virtual
bool
getOut
()
override
;
virtual
std
::
string
getType
()
override
virtual
void
setIn
(
size_
t
num
,
bool
state
)
override
;
virtual
bool
getOut
()
const
override
;
virtual
std
::
string
getType
()
const
override
{
return
"Delay"
;
}
...
...
extensions/LogicProcessor/TNOT.cc
View file @
070f1f5b
...
...
@@ -33,7 +33,7 @@ TNOT::~TNOT()
{
}
// -------------------------------------------------------------------------
void
TNOT
::
setIn
(
in
t
num
,
bool
state
)
void
TNOT
::
setIn
(
size_
t
num
,
bool
state
)
{
bool
prev
=
myout
;
myout
=
!
state
;
...
...
extensions/LogicProcessor/TOR.cc
View file @
070f1f5b
...
...
@@ -22,7 +22,7 @@
using
namespace
std
;
using
namespace
UniSetExtensions
;
// -------------------------------------------------------------------------
TOR
::
TOR
(
ElementID
id
,
unsigned
in
t
num
,
bool
st
)
:
TOR
::
TOR
(
ElementID
id
,
size_
t
num
,
bool
st
)
:
Element
(
id
),
myout
(
false
)
{
...
...
@@ -43,7 +43,7 @@ TOR::~TOR()
{
}
// -------------------------------------------------------------------------
void
TOR
::
setIn
(
in
t
num
,
bool
state
)
void
TOR
::
setIn
(
size_
t
num
,
bool
state
)
{
// cout << getType() << "(" << myid << "): input " << num << " set " << state << endl;
...
...
extensions/ModbusMaster/MBExchange.cc
View file @
070f1f5b
...
...
@@ -327,7 +327,7 @@ void MBExchange::step()
}
// -----------------------------------------------------------------------------
bool
MBExchange
::
checkProcActive
()
bool
MBExchange
::
checkProcActive
()
const
{
return
activated
;
}
...
...
@@ -509,7 +509,7 @@ bool MBExchange::checkUpdateSM( bool wrFunc, long mdev )
return
true
;
}
// -----------------------------------------------------------------------------
bool
MBExchange
::
checkPoll
(
bool
wrFunc
)
bool
MBExchange
::
checkPoll
(
bool
wrFunc
)
const
{
if
(
exchangeMode
==
emWriteOnly
&&
!
wrFunc
)
{
...
...
@@ -1463,14 +1463,14 @@ void MBExchange::updateRSProperty( RSProperty* p, bool write_only )
{
VTypes
::
F2
f2
(
f
);
for
(
in
t
k
=
0
;
k
<
VTypes
::
F2
::
wsize
();
k
++
,
i
++
)
for
(
size_
t
k
=
0
;
k
<
VTypes
::
F2
::
wsize
();
k
++
,
i
++
)
i
->
second
->
mbval
=
f2
.
raw
.
v
[
k
];
}
else
if
(
p
->
vType
==
VTypes
::
vtF2r
)
{
VTypes
::
F2r
f2
(
f
);
for
(
in
t
k
=
0
;
k
<
VTypes
::
F2r
::
wsize
();
k
++
,
i
++
)
for
(
size_
t
k
=
0
;
k
<
VTypes
::
F2r
::
wsize
();
k
++
,
i
++
)
i
->
second
->
mbval
=
f2
.
raw
.
v
[
k
];
}
...
...
@@ -1481,7 +1481,7 @@ void MBExchange::updateRSProperty( RSProperty* p, bool write_only )
{
ModbusRTU
::
ModbusData
*
data
=
new
ModbusRTU
::
ModbusData
[
VTypes
::
F2
::
wsize
()];
for
(
in
t
k
=
0
;
k
<
VTypes
::
F2
::
wsize
();
k
++
,
i
++
)
for
(
size_
t
k
=
0
;
k
<
VTypes
::
F2
::
wsize
();
k
++
,
i
++
)
data
[
k
]
=
i
->
second
->
mbval
;
float
f
=
0
;
...
...
@@ -1513,7 +1513,7 @@ void MBExchange::updateRSProperty( RSProperty* p, bool write_only )
float
f
=
IOBase
::
processingFasAO
(
p
,
shm
,
force_out
);
VTypes
::
F4
f4
(
f
);
for
(
in
t
k
=
0
;
k
<
VTypes
::
F4
::
wsize
();
k
++
,
i
++
)
for
(
size_
t
k
=
0
;
k
<
VTypes
::
F4
::
wsize
();
k
++
,
i
++
)
i
->
second
->
mbval
=
f4
.
raw
.
v
[
k
];
r
->
sm_initOK
=
true
;
...
...
@@ -1523,7 +1523,7 @@ void MBExchange::updateRSProperty( RSProperty* p, bool write_only )
{
ModbusRTU
::
ModbusData
*
data
=
new
ModbusRTU
::
ModbusData
[
VTypes
::
F4
::
wsize
()];
for
(
in
t
k
=
0
;
k
<
VTypes
::
F4
::
wsize
();
k
++
,
i
++
)
for
(
size_
t
k
=
0
;
k
<
VTypes
::
F4
::
wsize
();
k
++
,
i
++
)
data
[
k
]
=
i
->
second
->
mbval
;
VTypes
::
F4
f
(
data
,
VTypes
::
F4
::
wsize
());
...
...
@@ -1546,14 +1546,14 @@ void MBExchange::updateRSProperty( RSProperty* p, bool write_only )
{
VTypes
::
I2
i2
(
v
);
for
(
in
t
k
=
0
;
k
<
VTypes
::
I2
::
wsize
();
k
++
,
i
++
)
for
(
size_
t
k
=
0
;
k
<
VTypes
::
I2
::
wsize
();
k
++
,
i
++
)
i
->
second
->
mbval
=
i2
.
raw
.
v
[
k
];
}
else
if
(
p
->
vType
==
VTypes
::
vtI2r
)
{
VTypes
::
I2r
i2
(
v
);
for
(
in
t
k
=
0
;
k
<
VTypes
::
I2
::
wsize
();
k
++
,
i
++
)
for
(
size_
t
k
=
0
;
k
<
VTypes
::
I2
::
wsize
();
k
++
,
i
++
)
i
->
second
->
mbval
=
i2
.
raw
.
v
[
k
];
}
...
...
@@ -1564,7 +1564,7 @@ void MBExchange::updateRSProperty( RSProperty* p, bool write_only )
{
ModbusRTU
::
ModbusData
*
data
=
new
ModbusRTU
::
ModbusData
[
VTypes
::
I2
::
wsize
()];
for
(
in
t
k
=
0
;
k
<
VTypes
::
I2
::
wsize
();
k
++
,
i
++
)
for
(
size_
t
k
=
0
;
k
<
VTypes
::
I2
::
wsize
();
k
++
,
i
++
)
data
[
k
]
=
i
->
second
->
mbval
;
int
v
=
0
;
...
...
@@ -1598,14 +1598,14 @@ void MBExchange::updateRSProperty( RSProperty* p, bool write_only )
{
VTypes
::
U2
u2
(
v
);
for
(
in
t
k
=
0
;
k
<
VTypes
::
U2
::
wsize
();
k
++
,
i
++
)
for
(
size_
t
k
=
0
;
k
<
VTypes
::
U2
::
wsize
();
k
++
,
i
++
)
i
->
second
->
mbval
=
u2
.
raw
.
v
[
k
];
}
else
if
(
p
->
vType
==
VTypes
::
vtU2r
)
{
VTypes
::
U2r
u2
(
v
);
for
(
in
t
k
=
0
;
k
<
VTypes
::
U2
::
wsize
();
k
++
,
i
++
)
for
(
size_
t
k
=
0
;
k
<
VTypes
::
U2
::
wsize
();
k
++
,
i
++
)
i
->
second
->
mbval
=
u2
.
raw
.
v
[
k
];
}
...
...
@@ -1616,7 +1616,7 @@ void MBExchange::updateRSProperty( RSProperty* p, bool write_only )
{
ModbusRTU
::
ModbusData
*
data
=
new
ModbusRTU
::
ModbusData
[
VTypes
::
U2
::
wsize
()];
for
(
in
t
k
=
0
;
k
<
VTypes
::
U2
::
wsize
();
k
++
,
i
++
)
for
(
size_
t
k
=
0
;
k
<
VTypes
::
U2
::
wsize
();
k
++
,
i
++
)
data
[
k
]
=
i
->
second
->
mbval
;
unsigned
int
v
=
0
;
...
...
extensions/ModbusMaster/MBExchange.h
View file @
070f1f5b
...
...
@@ -301,9 +301,9 @@ class MBExchange:
virtual
void
updateRespondSensors
();
bool
checkUpdateSM
(
bool
wrFunc
,
long
devMode
);
bool
checkPoll
(
bool
wrFunc
);
bool
checkPoll
(
bool
wrFunc
)
const
;
bool
checkProcActive
();
bool
checkProcActive
()
const
;
void
setProcActive
(
bool
st
);
void
waitSMReady
();
...
...
extensions/ModbusMaster/MBTCPMultiMaster.cc
View file @
070f1f5b
...
...
@@ -316,7 +316,7 @@ void MBTCPMultiMaster::final_thread()
}
// -----------------------------------------------------------------------------
bool
MBTCPMultiMaster
::
MBSlaveInfo
::
check
()
bool
MBTCPMultiMaster
::
MBSlaveInfo
::
check
()
const
{
return
mbtcp
->
checkConnection
(
ip
,
port
,
recv_timeout
);
}
...
...
extensions/ModbusMaster/MBTCPMultiMaster.h
View file @
070f1f5b
...
...
@@ -302,7 +302,7 @@ class MBTCPMultiMaster:
}
bool
init
(
std
::
shared_ptr
<
DebugStream
>&
mblog
);
bool
check
();
bool
check
()
const
;
inline
void
setUse
(
bool
st
)
{
respond_init
=
!
(
st
&&
!
use
);
...
...
extensions/UNetUDP/UDPPacket.cc
View file @
070f1f5b
...
...
@@ -317,7 +317,7 @@ size_t UDPMessage::getMessage( UDPMessage& m, UDPPacket& p )
return
i
+
sz
;
}
// -----------------------------------------------------------------------------
uint16_t
UDPMessage
::
getDataCRC
()
uint16_t
UDPMessage
::
getDataCRC
()
const
{
uint16_t
crc
[
3
];
crc
[
0
]
=
makeCRC
(
(
unsigned
char
*
)(
a_dat
),
sizeof
(
a_dat
)
);
...
...
extensions/UNetUDP/UDPPacket.h
View file @
070f1f5b
...
...
@@ -128,7 +128,7 @@ namespace UniSetUDP
return
acount
;
}
uint16_t
getDataCRC
();
uint16_t
getDataCRC
()
const
;
// количество байт в пакете с булевыми переменными...
size_t
d_byte
()
const
...
...
extensions/include/MTR.h
View file @
070f1f5b
...
...
@@ -54,7 +54,7 @@ namespace MTR
// -------------------------------------------------------------------------
std
::
string
type2str
(
MTRType
t
);
/*!< преоразование строки в тип */
MTRType
str2type
(
const
std
::
string
&
s
);
/*!< преобразование названия в строку */
in
t
wsize
(
MTRType
t
);
/*!< длина данных в словах */
size_
t
wsize
(
MTRType
t
);
/*!< длина данных в словах */
// -------------------------------------------------------------------------
// Информация
const
ModbusRTU
::
ModbusData
regModelNumber
=
0x01
;
...
...
@@ -129,7 +129,7 @@ namespace MTR
void
update_communication_params
(
ModbusRTU
::
ModbusAddr
reg
,
ModbusRTU
::
ModbusData
data
,
ModbusRTUMaster
*
mb
,
ModbusRTU
::
ModbusAddr
&
addr
,
int
verb
);
// -------------------------------------------------------------------------
static
const
in
t
u2size
=
2
;
static
const
size_
t
u2size
=
2
;
// -------------------------------------------------------------------------
class
T1
{
...
...
@@ -140,7 +140,7 @@ namespace MTR
~
T1
()
{}
// ------------------------------------------
/*! размер в словах */
static
unsigned
in
t
wsize
()
static
size_
t
wsize
()
{
return
1
;
}
...
...
@@ -163,7 +163,7 @@ namespace MTR
~
T2
()
{}
// ------------------------------------------
/*! размер в словах */
static
unsigned
in
t
wsize
()
static
size_
t
wsize
()
{
return
1
;
}
...
...
@@ -205,7 +205,7 @@ namespace MTR
raw
.
v
[
1
]
=
v2
;
}
T3
(
const
ModbusRTU
::
ModbusData
*
data
,
in
t
size
)
T3
(
const
ModbusRTU
::
ModbusData
*
data
,
size_
t
size
)
{
if
(
size
>=
u2size
)
{
...
...
@@ -218,7 +218,7 @@ namespace MTR
~
T3
()
{}
// ------------------------------------------
/*! размер в словах */
static
unsigned
in
t
wsize
()
static
size_
t
wsize
()
{
return
u2size
;
}
...
...
@@ -262,7 +262,7 @@ namespace MTR
~
T4
()
{}
// ------------------------------------------
/*! размер в словах */
static
unsigned
in
t
wsize
()
static
size_
t
wsize
()
{
return
1
;
}
...
...
@@ -311,7 +311,7 @@ namespace MTR
val
=
raw
.
u2
.
val
*
pow
(
(
long
)
10
,
(
long
)
raw
.
u2
.
exp
);
}
T5
(
const
ModbusRTU
::
ModbusData
*
data
,
in
t
size
)
:
val
(
0
)
T5
(
const
ModbusRTU
::
ModbusData
*
data
,
size_
t
size
)
:
val
(
0
)
{
if
(
size
>=
u2size
)
{
...
...
@@ -325,7 +325,7 @@ namespace MTR
~
T5
()
{}
// ------------------------------------------
/*! размер в словах */
static
unsigned
in
t
wsize
()
static
size_
t
wsize
()
{
return
u2size
;
}
...
...
@@ -374,7 +374,7 @@ namespace MTR
val
=
raw
.
u2
.
val
*
pow
(
(
long
)
10
,
(
long
)
raw
.
u2
.
exp
);
}
T6
(
const
ModbusRTU
::
ModbusData
*
data
,
in
t
size
)
T6
(
const
ModbusRTU
::
ModbusData
*
data
,
size_
t
size
)
{
if
(
size
>=
u2size
)
{
...
...
@@ -388,7 +388,7 @@ namespace MTR
~
T6
()
{}
// ------------------------------------------
/*! размер в словах */
static
unsigned
in
t
wsize
()
static
size_
t
wsize
()
{
return
u2size
;
}
...
...
@@ -437,7 +437,7 @@ namespace MTR
val
=
raw
.
u2
.
val
*
pow
(
(
long
)
10
,
(
long
)
-
4
);
}
T7
(
const
ModbusRTU
::
ModbusData
*
data
,
in
t
size
)
T7
(
const
ModbusRTU
::
ModbusData
*
data
,
size_
t
size
)
{
if
(
size
>=
u2size
)
{
...
...
@@ -451,7 +451,7 @@ namespace MTR
~
T7
()
{}
// ------------------------------------------
/*! размер в словах */
static
unsigned
in
t
wsize
()
static
size_
t
wsize
()
{
return
u2size
;
}
...
...
@@ -494,7 +494,7 @@ namespace MTR
raw
.
v
[
1
]
=
v2
;
}
T8
(
const
ModbusRTU
::
ModbusData
*
data
,
in
t
size
)
T8
(
const
ModbusRTU
::
ModbusData
*
data
,
size_
t
size
)
{
if
(
size
>=
u2size
)
{
...
...
@@ -524,7 +524,7 @@ namespace MTR
~
T8
()
{}
// ------------------------------------------
/*! размер в словах */
static
unsigned
in
t
wsize
()
static
size_
t
wsize
()
{
return
u2size
;
}
...
...
@@ -566,7 +566,7 @@ namespace MTR
raw
.
v
[
1
]
=
v2
;
}
T9
(
const
ModbusRTU
::
ModbusData
*
data
,
in
t
size
)
T9
(
const
ModbusRTU
::
ModbusData
*
data
,
size_
t
size
)
{
if
(
size
>=
u2size
)
{
...
...
@@ -596,7 +596,7 @@ namespace MTR
~
T9
()
{}
// ------------------------------------------
/*! размер в словах */
static
unsigned
in
t
wsize
()
static
size_
t
wsize
()
{
return
u2size
;
}
...
...
@@ -637,7 +637,7 @@ namespace MTR
raw
.
v
[
1
]
=
v2
;
}
T10
(
const
ModbusRTU
::
ModbusData
*
data
,
in
t
size
)
T10
(
const
ModbusRTU
::
ModbusData
*
data
,
size_
t
size
)
{
if
(
size
>=
u2size
)
{
...
...
@@ -663,7 +663,7 @@ namespace MTR
~
T10
()
{}
// ------------------------------------------
/*! размер в словах */
static
unsigned
in
t
wsize
()
static
size_
t
wsize
()
{
return
u2size
;
}
...
...
@@ -698,7 +698,7 @@ namespace MTR
~
T16
()
{}
// ------------------------------------------
/*! размер в словах */
static
unsigned
in
t
wsize
()
static
size_
t
wsize
()
{
return
1
;
}
...
...
@@ -746,7 +746,7 @@ namespace MTR
~
T17
()
{}
// ------------------------------------------
/*! размер в словах */
static
unsigned
in
t
wsize
()
static
size_
t
wsize
()
{
return
1
;
}
...
...
@@ -797,7 +797,7 @@ namespace MTR
raw
.
val
=
f
;
}
F1
(
const
ModbusRTU
::
ModbusData
*
data
,
in
t
size
)
F1
(
const
ModbusRTU
::
ModbusData
*
data
,
size_
t
size
)
{
if
(
size
>=
u2size
)
{
...
...
@@ -810,7 +810,7 @@ namespace MTR
~
F1
()
{}
// ------------------------------------------
/*! размер в словах */
static
unsigned
in
t
wsize
()
static
size_
t
wsize
()
{
return
u2size
;
}
...
...
@@ -855,7 +855,7 @@ namespace MTR
~
T_Str16
()
{}
// ------------------------------------------
/*! размер в словах */
static
unsigned
in
t
wsize
()
static
size_
t
wsize
()
{
return
8
;
}
...
...
@@ -892,7 +892,7 @@ namespace MTR
~
T_Str8
()
{}
// ------------------------------------------
/*! размер в словах */
static
unsigned
in
t
wsize
()
static
size_
t
wsize
()
{
return
4
;
}
...
...
extensions/include/UObject_SK.h
View file @
070f1f5b
...
...
@@ -8,7 +8,7 @@
ВСЕ ВАШИ ИЗМЕНЕНИЯ БУДУТ ПОТЕРЯНЫ.
*/
// --------------------------------------------------------------------------
// generate timestamp: 2016-0
7-26
+03:00
// generate timestamp: 2016-0
8-01
+03:00
// -----------------------------------------------------------------------------
#ifndef UObject_SK_H_
#define UObject_SK_H_
...
...
@@ -107,13 +107,13 @@ class UObject_SK:
\param id - идентификатор датчика
\param showLinkName - TRUE - выводить SensorName, FALSE - не выводить
*/
std
::
string
str
(
UniSetTypes
::
ObjectId
id
,
bool
showLinkName
=
true
);
std
::
string
str
(
UniSetTypes
::
ObjectId
id
,
bool
showLinkName
=
true
)
const
;
/*! Вывод значения входа/выхода в формате: in_xxx(SensorName)=val
\param id - идентификатор датчика
\param showLinkName - TRUE - выводить SensorName, FALSE - не выводить
*/
std
::
string
strval
(
UniSetTypes
::
ObjectId
id
,
bool
showLinkName
=
true
);
std
::
string
strval
(
UniSetTypes
::
ObjectId
id
,
bool
showLinkName
=
true
)
const
;
/*! Вывод состояния внутренних переменных */
inline
std
::
string
dumpVars
(){
return
std
::
move
(
vmon
.
pretty_str
());
}
...
...
extensions/include/VTypes.h
View file @
070f1f5b
...
...
@@ -54,7 +54,7 @@ namespace VTypes
public
:
// ------------------------------------------
static
const
in
t
f2Size
=
2
;
static
const
size_
t
f2Size
=
2
;
/*! тип хранения в памяти */
typedef
union
{
...
...
@@ -72,16 +72,16 @@ namespace VTypes
{
raw
.
val
=
f
;
}
F2
(
const
ModbusRTU
::
ModbusData
*
data
,
in
t
size
)
F2
(
const
ModbusRTU
::
ModbusData
*
data
,
size_
t
size
)
{
for
(
in
t
i
=
0
;
i
<
wsize
()
&&
i
<
size
;
i
++
)
for
(
size_
t
i
=
0
;
i
<
wsize
()
&&
i
<
size
;
i
++
)
raw
.
v
[
i
]
=
data
[
i
];
}
~
F2
()
{}
// ------------------------------------------
/*! размер в словах */
static
in
t
wsize
()
static
size_
t
wsize
()
{
return
f2Size
;
}
...
...
@@ -121,7 +121,7 @@ namespace VTypes
raw_backorder
=
raw
;
std
::
swap
(
raw_backorder
.
v
[
0
],
raw_backorder
.
v
[
1
]);
}
F2r
(
const
ModbusRTU
::
ModbusData
*
data
,
in
t
size
)
:
F2
(
data
,
size
)
F2r
(
const
ModbusRTU
::
ModbusData
*
data
,
size_
t
size
)
:
F2
(
data
,
size
)
{
// принимаем в обратном порядке.. поэтому переворачиваем raw
raw_backorder
=
raw
;
...
...
@@ -137,7 +137,7 @@ namespace VTypes
{
public
:
// ------------------------------------------
static
const
in
t
f4Size
=
4
;
static
const
size_
t
f4Size
=
4
;
/*! тип хранения в памяти */
typedef
union
{
...
...
@@ -155,16 +155,16 @@ namespace VTypes
{
raw
.
val
=
f
;
}
F4
(
const
ModbusRTU
::
ModbusData
*
data
,
in
t
size
)
F4
(
const
ModbusRTU
::
ModbusData
*
data
,
size_
t
size
)
{
for
(
in
t
i
=
0
;
i
<
wsize
()
&&
i
<
size
;
i
++
)
for
(
size_
t
i
=
0
;
i
<
wsize
()
&&
i
<
size
;
i
++
)
raw
.
v
[
i
]
=
data
[
i
];
}
~
F4
()
{}
// ------------------------------------------
/*! размер в словах */
static
in
t
wsize
()
static
size_
t
wsize
()
{
return
f4Size
;
}
...
...
@@ -190,7 +190,7 @@ namespace VTypes
{
public
:
static
const
in
t
bsize
=
2
;
static
const
size_
t
bsize
=
2
;
// ------------------------------------------
/*! тип хранения в памяти */
...
...
@@ -224,7 +224,7 @@ namespace VTypes
~
Byte
()
{}
// ------------------------------------------
/*! размер в словах */
static
in
t
wsize
()
static
size_
t
wsize
()
{
return
1
;
}
...
...
@@ -272,7 +272,7 @@ namespace VTypes
~
Unsigned
()
{}
// ------------------------------------------
/*! размер в словах */
static
in
t
wsize
()
static
size_
t
wsize
()
{
return
1
;
}
...
...
@@ -311,7 +311,7 @@ namespace VTypes
~
Signed
()
{}
// ------------------------------------------
/*! размер в словах */
static
in
t
wsize
()
static
size_
t
wsize
()
{
return
1
;
}
...
...
@@ -334,7 +334,7 @@ namespace VTypes
public
:
// ------------------------------------------
static
const
in
t
i2Size
=
2
;
static
const
size_
t
i2Size
=
2
;
/*! тип хранения в памяти */
typedef
union
{
...
...
@@ -352,16 +352,16 @@ namespace VTypes
{
raw
.
val
=
v
;
}
I2
(
const
ModbusRTU
::
ModbusData
*
data
,
in
t
size
)
I2
(
const
ModbusRTU
::
ModbusData
*
data
,
size_
t
size
)
{
for
(
in
t
i
=
0
;
i
<
wsize
()
&&
i
<
size
;
i
++
)
for
(
size_
t
i
=
0
;
i
<
wsize
()
&&
i
<
size
;
i
++
)
raw
.
v
[
i
]
=
data
[
i
];
}
~
I2
()
{}
// ------------------------------------------
/*! размер в словах */
static
in
t
wsize
()
static
size_
t
wsize
()
{
return
i2Size
;
}
...
...
@@ -390,7 +390,7 @@ namespace VTypes
raw_backorder
=
raw
;
std
::
swap
(
raw_backorder
.
v
[
0
],
raw_backorder
.
v
[
1
]);
}
I2r
(
const
ModbusRTU
::
ModbusData
*
data
,
in
t
size
)
:
I2
(
data
,
size
)
I2r
(
const
ModbusRTU
::
ModbusData
*
data
,
size_
t
size
)
:
I2
(
data
,
size
)
{
// принимаем в обратном порядке.. поэтому переворачиваем raw
raw_backorder
=
raw
;
...
...
@@ -407,7 +407,7 @@ namespace VTypes
public
:
// ------------------------------------------
static
const
in
t
u2Size
=
2
;
static
const
size_
t
u2Size
=
2
;
/*! тип хранения в памяти */
typedef
union
{
...
...
@@ -425,16 +425,16 @@ namespace VTypes
{
raw
.
val
=
v
;
}
U2
(
const
ModbusRTU
::
ModbusData
*
data
,
in
t
size
)
U2
(
const
ModbusRTU
::
ModbusData
*
data
,
size_
t
size
)
{
for
(
in
t
i
=
0
;
i
<
wsize
()
&&
i
<
size
;
i
++
)
for
(
size_
t
i
=
0
;
i
<
wsize
()
&&
i
<
size
;
i
++
)
raw
.
v
[
i
]
=
data
[
i
];
}
~
U2
()
{}
// ------------------------------------------
/*! размер в словах */
static
in
t
wsize
()
static
size_
t
wsize
()
{
return
u2Size
;
}
...
...
@@ -463,7 +463,7 @@ namespace VTypes
raw_backorder
=
raw
;
std
::
swap
(
raw_backorder
.
v
[
0
],
raw_backorder
.
v
[
1
]);
}
U2r
(
const
ModbusRTU
::
ModbusData
*
data
,
in
t
size
)
:
U2
(
data
,
size
)
U2r
(
const
ModbusRTU
::
ModbusData
*
data
,
size_
t
size
)
:
U2
(
data
,
size
)
{
// принимаем в обратном порядке.. поэтому переворачиваем raw
raw_backorder
=
raw
;
...
...
extensions/lib/MTR.cc
View file @
070f1f5b
...
...
@@ -128,7 +128,7 @@ namespace MTR
return
"Unknown"
;
}
// -------------------------------------------------------------------------
in
t
wsize
(
MTRType
t
)
size_
t
wsize
(
MTRType
t
)
{
if
(
t
==
mtT1
)
return
T1
::
wsize
();
...
...
extensions/lib/UObject_SK.cc
View file @
070f1f5b
...
...
@@ -11,7 +11,7 @@
ВСЕ ВАШИ ИЗМЕНЕНИЯ БУДУТ ПОТЕРЯНЫ.
*/
// --------------------------------------------------------------------------
// generate timestamp: 2016-0
7-26
+03:00
// generate timestamp: 2016-0
8-01
+03:00
// -----------------------------------------------------------------------------
#include <memory>
#include <iomanip>
...
...
@@ -305,14 +305,14 @@ std::string UObject_SK::dumpIO()
return
std
::
move
(
s
.
str
());
}
// ----------------------------------------------------------------------------
std
::
string
UObject_SK
::
str
(
UniSetTypes
::
ObjectId
id
,
bool
showLinkName
)
std
::
string
UObject_SK
::
str
(
UniSetTypes
::
ObjectId
id
,
bool
showLinkName
)
const
{
ostringstream
s
;
return
""
;
}
// ----------------------------------------------------------------------------
std
::
string
UObject_SK
::
strval
(
UniSetTypes
::
ObjectId
id
,
bool
showLinkName
)
std
::
string
UObject_SK
::
strval
(
UniSetTypes
::
ObjectId
id
,
bool
showLinkName
)
const
{
ostringstream
s
;
...
...
include/EventLoopServer.h
View file @
070f1f5b
...
...
@@ -18,7 +18,7 @@ class EventLoopServer
EventLoopServer
();
virtual
~
EventLoopServer
();
bool
evIsActive
();
bool
evIsActive
()
const
;
protected
:
// действия при завершении
...
...
include/HourGlass.h
View file @
070f1f5b
...
...
@@ -123,19 +123,19 @@ class HourGlass
}
// получить прошедшее время
inline
timeout_t
current
()
inline
timeout_t
current
()
const
{
return
t
.
getCurrent
();
}
// получить заданное время
inline
timeout_t
interval
()
inline
timeout_t
interval
()
const
{
return
t
.
getInterval
();
}
// проверить наступление
inline
bool
check
()
inline
bool
check
()
const
{
// пока часы не "стоят"
// всегда false
...
...
@@ -145,7 +145,7 @@ class HourGlass
return
t
.
checkTime
();
}
inline
bool
enabled
()
inline
bool
enabled
()
const
{
return
_state
;
}
...
...
include/LogSession.h
View file @
070f1f5b
...
...
@@ -44,11 +44,10 @@ class LogSession
typedef
sigc
::
signal
<
std
::
string
,
LogSession
*
,
LogServerTypes
::
Command
,
const
std
::
string
&
>
LogSessionCommand_Signal
;
LogSessionCommand_Signal
signal_logsession_command
();
inline
void
cancel
()
{
cancelled
=
true
;
}
inline
std
::
string
getClientAddress
()
// прервать работу
void
cancel
();
inline
std
::
string
getClientAddress
()
const
{
return
caddr
;
}
...
...
@@ -68,17 +67,13 @@ class LogSession
//! Установить размер буфера для сообщений (количество записей. Не размер в байтах!!)
void
setMaxBufSize
(
size_t
num
);
inline
size_t
getMaxBufSize
()
{
return
maxRecordsNum
;
}
size_t
getMaxBufSize
()
const
;
// запуск обработки входящих запросов
void
run
(
const
ev
::
loop_ref
&
loop
);
void
terminate
();
bool
isAcive
();
bool
isAcive
()
const
;
std
::
string
getShortInfo
();
...
...
include/MQAtomic.h
View file @
070f1f5b
...
...
@@ -70,14 +70,14 @@ class MQAtomic
*/
VoidMessagePtr
top
();
size_t
size
();
bool
empty
();
size_t
size
()
const
;
bool
empty
()
const
;
// ----- Настройки -----
// неявно подразумевается, что всё настривается до первого использования
// ----------------------
void
setMaxSizeOfMessageQueue
(
size_t
s
);
size_t
getMaxSizeOfMessageQueue
();
size_t
getMaxSizeOfMessageQueue
()
const
;
/*! Стратегия при переполнении */
enum
LostStrategy
...
...
include/MQMutex.h
View file @
070f1f5b
...
...
@@ -56,7 +56,7 @@ class MQMutex
// неявно подразумевается, что всё настраивается до первого использования
// ----------------------
void
setMaxSizeOfMessageQueue
(
size_t
s
);
size_t
getMaxSizeOfMessageQueue
();
size_t
getMaxSizeOfMessageQueue
()
const
;
/*! Стратегия при переполнении */
enum
LostStrategy
...
...
include/ObjectIndex.h
View file @
070f1f5b
...
...
@@ -34,32 +34,32 @@ namespace UniSetTypes
virtual
~
ObjectIndex
()
{};
// info
virtual
const
ObjectInfo
*
getObjectInfo
(
const
UniSetTypes
::
ObjectId
)
=
0
;
virtual
const
ObjectInfo
*
getObjectInfo
(
const
std
::
string
&
name
)
=
0
;
virtual
const
ObjectInfo
*
getObjectInfo
(
const
UniSetTypes
::
ObjectId
)
const
=
0
;
virtual
const
ObjectInfo
*
getObjectInfo
(
const
std
::
string
&
name
)
const
=
0
;
static
std
::
string
getBaseName
(
const
std
::
string
&
fname
);
// object id
virtual
ObjectId
getIdByName
(
const
std
::
string
&
name
)
=
0
;
virtual
std
::
string
getNameById
(
const
UniSetTypes
::
ObjectId
id
);
virtual
ObjectId
getIdByName
(
const
std
::
string
&
name
)
const
=
0
;
virtual
std
::
string
getNameById
(
const
UniSetTypes
::
ObjectId
id
)
const
;
// node
inline
std
::
string
getNodeName
(
const
UniSetTypes
::
ObjectId
id
)
inline
std
::
string
getNodeName
(
const
UniSetTypes
::
ObjectId
id
)
const
{
return
getNameById
(
id
);
}
inline
ObjectId
getNodeId
(
const
std
::
string
&
name
)
inline
ObjectId
getNodeId
(
const
std
::
string
&
name
)
const
{
return
getIdByName
(
name
);
}
// src name
virtual
std
::
string
getMapName
(
const
UniSetTypes
::
ObjectId
id
)
=
0
;
virtual
std
::
string
getTextName
(
const
UniSetTypes
::
ObjectId
id
)
=
0
;
virtual
std
::
string
getMapName
(
const
UniSetTypes
::
ObjectId
id
)
const
=
0
;
virtual
std
::
string
getTextName
(
const
UniSetTypes
::
ObjectId
id
)
const
=
0
;
//
virtual
std
::
ostream
&
printMap
(
std
::
ostream
&
os
)
=
0
;
virtual
std
::
ostream
&
printMap
(
std
::
ostream
&
os
)
const
=
0
;
void
initLocalNode
(
const
UniSetTypes
::
ObjectId
nodeid
);
...
...
include/ObjectIndex_Array.h
View file @
070f1f5b
...
...
@@ -42,23 +42,23 @@ namespace UniSetTypes
ObjectIndex_Array
(
const
ObjectInfo
*
objectInfo
);
virtual
~
ObjectIndex_Array
();
virtual
const
ObjectInfo
*
getObjectInfo
(
const
ObjectId
)
override
;
virtual
const
ObjectInfo
*
getObjectInfo
(
const
std
::
string
&
name
)
override
;
virtual
ObjectId
getIdByName
(
const
std
::
string
&
name
)
override
;
virtual
std
::
string
getMapName
(
const
ObjectId
id
)
override
;
virtual
std
::
string
getTextName
(
const
ObjectId
id
)
override
;
virtual
const
ObjectInfo
*
getObjectInfo
(
const
ObjectId
)
const
override
;
virtual
const
ObjectInfo
*
getObjectInfo
(
const
std
::
string
&
name
)
const
override
;
virtual
ObjectId
getIdByName
(
const
std
::
string
&
name
)
const
override
;
virtual
std
::
string
getMapName
(
const
ObjectId
id
)
const
override
;
virtual
std
::
string
getTextName
(
const
ObjectId
id
)
const
override
;
virtual
std
::
ostream
&
printMap
(
std
::
ostream
&
os
)
override
;
virtual
std
::
ostream
&
printMap
(
std
::
ostream
&
os
)
const
override
;
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
ObjectIndex_Array
&
oi
);
private
:
in
t
numOfObject
;
size_
t
numOfObject
;
typedef
std
::
unordered_map
<
std
::
string
,
ObjectId
>
MapObjectKey
;
MapObjectKey
::
iterator
MapObjectKeyIterator
;
MapObjectKey
mok
;
const
ObjectInfo
*
objectInfo
;
in
t
maxId
;
size_
t
maxId
;
};
// -----------------------------------------------------------------------------------------
}
// end of namespace
...
...
include/ObjectIndex_XML.h
View file @
070f1f5b
...
...
@@ -36,17 +36,17 @@ namespace UniSetTypes
public
ObjectIndex
{
public
:
ObjectIndex_XML
(
const
std
::
string
&
xmlfile
,
in
t
minSize
=
1000
);
ObjectIndex_XML
(
const
std
::
shared_ptr
<
UniXML
>&
xml
,
in
t
minSize
=
1000
);
ObjectIndex_XML
(
const
std
::
string
&
xmlfile
,
size_
t
minSize
=
1000
);
ObjectIndex_XML
(
const
std
::
shared_ptr
<
UniXML
>&
xml
,
size_
t
minSize
=
1000
);
virtual
~
ObjectIndex_XML
();
virtual
const
UniSetTypes
::
ObjectInfo
*
getObjectInfo
(
const
ObjectId
)
override
;
virtual
const
UniSetTypes
::
ObjectInfo
*
getObjectInfo
(
const
std
::
string
&
name
)
override
;
virtual
ObjectId
getIdByName
(
const
std
::
string
&
name
)
override
;
virtual
std
::
string
getMapName
(
const
ObjectId
id
)
override
;
virtual
std
::
string
getTextName
(
const
ObjectId
id
)
override
;
virtual
const
UniSetTypes
::
ObjectInfo
*
getObjectInfo
(
const
ObjectId
)
const
override
;
virtual
const
UniSetTypes
::
ObjectInfo
*
getObjectInfo
(
const
std
::
string
&
name
)
const
override
;
virtual
ObjectId
getIdByName
(
const
std
::
string
&
name
)
const
override
;
virtual
std
::
string
getMapName
(
const
ObjectId
id
)
const
override
;
virtual
std
::
string
getTextName
(
const
ObjectId
id
)
const
override
;
virtual
std
::
ostream
&
printMap
(
std
::
ostream
&
os
)
override
;
virtual
std
::
ostream
&
printMap
(
std
::
ostream
&
os
)
const
override
;
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
ObjectIndex_XML
&
oi
);
protected
:
...
...
include/ObjectIndex_idXML.h
View file @
070f1f5b
...
...
@@ -30,13 +30,13 @@ class ObjectIndex_idXML:
ObjectIndex_idXML
(
const
std
::
shared_ptr
<
UniXML
>&
xml
);
virtual
~
ObjectIndex_idXML
();
virtual
const
UniSetTypes
::
ObjectInfo
*
getObjectInfo
(
const
UniSetTypes
::
ObjectId
)
override
;
virtual
const
UniSetTypes
::
ObjectInfo
*
getObjectInfo
(
const
std
::
string
&
name
)
override
;
virtual
UniSetTypes
::
ObjectId
getIdByName
(
const
std
::
string
&
name
)
override
;
virtual
std
::
string
getMapName
(
const
UniSetTypes
::
ObjectId
id
)
override
;
virtual
std
::
string
getTextName
(
const
UniSetTypes
::
ObjectId
id
)
override
;
virtual
const
UniSetTypes
::
ObjectInfo
*
getObjectInfo
(
const
UniSetTypes
::
ObjectId
)
const
override
;
virtual
const
UniSetTypes
::
ObjectInfo
*
getObjectInfo
(
const
std
::
string
&
name
)
const
override
;
virtual
UniSetTypes
::
ObjectId
getIdByName
(
const
std
::
string
&
name
)
const
override
;
virtual
std
::
string
getMapName
(
const
UniSetTypes
::
ObjectId
id
)
const
override
;
virtual
std
::
string
getTextName
(
const
UniSetTypes
::
ObjectId
id
)
const
override
;
virtual
std
::
ostream
&
printMap
(
std
::
ostream
&
os
)
override
;
virtual
std
::
ostream
&
printMap
(
std
::
ostream
&
os
)
const
override
;
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
ObjectIndex_idXML
&
oi
);
protected
:
...
...
include/Restorer.h
View file @
070f1f5b
...
...
@@ -73,7 +73,6 @@ class Restorer_XML
it - интератор(указатель) на текущий считываемый xml-узел (<consumer>)
sec - указатель на текущий узел сообщения (<item>)
*/
void
setReadConsumerItem
(
ReaderSlot
sl
);
...
...
include/Trigger.h
View file @
070f1f5b
...
...
@@ -69,7 +69,7 @@ class Trigger
return
false
;
}
inline
bool
get
()
inline
bool
get
()
const
{
return
oldstate
;
}
...
...
include/TriggerAND.h
View file @
070f1f5b
...
...
@@ -82,13 +82,13 @@ class TriggerAND
TriggerAND
(
Caller
*
r
,
Action
a
);
~
TriggerAND
();
inline
bool
state
()
inline
bool
state
()
const
{
return
out
;
}
bool
getState
(
InputType
in
);
bool
getState
(
InputType
in
)
const
;
bool
commit
(
InputType
in
,
bool
state
);
void
add
(
InputType
in
,
bool
state
);
...
...
include/TriggerAND.tcc
View file @
070f1f5b
...
...
@@ -69,9 +69,9 @@ void TriggerAND<Caller,InputType>::remove(InputType num)
//---------------------------------------------------------------------------
template<class Caller, typename InputType>
bool TriggerAND<Caller,InputType>::getState(InputType num)
bool TriggerAND<Caller,InputType>::getState(InputType num)
const
{
typename InputMap::iterator
it=inputs.find(num);
auto
it=inputs.find(num);
if( it!=inputs.end() )
return it->second;
...
...
include/TriggerOR.h
View file @
070f1f5b
...
...
@@ -81,12 +81,12 @@ class TriggerOR
TriggerOR
(
Caller
*
r
,
Action
a
);
~
TriggerOR
();
inline
bool
state
()
inline
bool
state
()
const
{
return
out
;
}
bool
getState
(
InputType
in
);
bool
getState
(
InputType
in
)
const
;
bool
commit
(
InputType
in
,
bool
state
);
void
add
(
InputType
in
,
bool
state
);
...
...
include/TriggerOR.tcc
View file @
070f1f5b
...
...
@@ -60,7 +60,7 @@ void TriggerOR<Caller,InputType>::add(InputType num, bool state)
template<class Caller, typename InputType>
void TriggerOR<Caller,InputType>::remove(InputType num)
{
typename InputMap::iterator
it=inputs.find(num);
auto
it=inputs.find(num);
if( it!=inputs.end() )
inputs.erase(it);
...
...
@@ -69,9 +69,9 @@ void TriggerOR<Caller,InputType>::remove(InputType num)
//---------------------------------------------------------------------------
template<class Caller, typename InputType>
bool TriggerOR<Caller,InputType>::getState(InputType num)
bool TriggerOR<Caller,InputType>::getState(InputType num)
const
{
typename InputMap::iterator
it=inputs.find(num);
auto
it=inputs.find(num);
if( it!=inputs.end() )
return it->second;
...
...
include/TriggerOUT.h
View file @
070f1f5b
...
...
@@ -94,7 +94,7 @@ class TriggerOUT
/*! получить текущее значение указанного 'выхода' */
bool
getState
(
OutIdType
out
);
bool
getState
(
OutIdType
out
)
const
;
/*! установить значение одного из 'выходов'
\param out - идентификатор 'выхода'
...
...
include/TriggerOUT.tcc
View file @
070f1f5b
...
...
@@ -57,7 +57,7 @@ void TriggerOUT<Caller,OutIdType,ValueType>::remove(OutIdType num)
//---------------------------------------------------------------------------
template <class Caller, typename OutIdType, typename ValueType>
bool TriggerOUT<Caller,OutIdType,ValueType>::getState(OutIdType out)
bool TriggerOUT<Caller,OutIdType,ValueType>::getState(OutIdType out)
const
{
auto it=outs.find(out);
if( it!=outs.end() )
...
...
include/UDPCore.h
View file @
070f1f5b
...
...
@@ -18,7 +18,7 @@ class UDPSocketU:
virtual
~
UDPSocketU
()
{}
inline
SOCKET
getSocket
()
inline
SOCKET
getSocket
()
const
{
return
ost
::
UDPSocket
::
so
;
}
...
...
include/UniSetActivator.h
View file @
070f1f5b
...
...
@@ -76,7 +76,7 @@ class UniSetActivator:
typedef
sigc
::
signal
<
void
,
int
>
TerminateEvent_Signal
;
TerminateEvent_Signal
signal_terminate_event
();
inline
bool
noUseGdbForStackTrace
()
inline
bool
noUseGdbForStackTrace
()
const
{
return
_noUseGdbForStackTrace
;
}
...
...
include/UniXML.h
View file @
070f1f5b
...
...
@@ -187,7 +187,7 @@ class UniXML
void
open
(
const
std
::
string
&
filename
);
void
close
();
inline
bool
isOpen
()
inline
bool
isOpen
()
const
{
return
doc
!=
0
;
}
...
...
@@ -198,7 +198,7 @@ class UniXML
~
UniXML
();
xmlDoc
*
doc
;
inline
std
::
string
getFileName
()
inline
std
::
string
getFileName
()
const
{
return
filename
;
}
...
...
include/modbus/ModbusClient.h
View file @
070f1f5b
...
...
@@ -150,12 +150,11 @@ class ModbusClient
void
initLog
(
std
::
shared_ptr
<
UniSetTypes
::
Configuration
>
conf
,
const
std
::
string
&
name
,
const
std
::
string
&
logfile
=
""
);
void
setLog
(
std
::
shared_ptr
<
DebugStream
>
dlog
);
inline
void
setCRCNoCheckit
(
bool
set
)
{
crcNoCheckit
=
set
;
}
inline
bool
isCRCNoCheckit
()
inline
bool
isCRCNoCheckit
()
const
{
return
crcNoCheckit
;
}
...
...
include/modbus/ModbusRTUSlave.h
View file @
070f1f5b
...
...
@@ -39,7 +39,7 @@ class ModbusRTUSlave:
}
virtual
void
terminate
()
override
;
virtual
bool
isActive
()
override
;
virtual
bool
isActive
()
const
override
;
protected
:
...
...
include/modbus/ModbusServer.h
View file @
070f1f5b
...
...
@@ -98,7 +98,7 @@ class ModbusServer
{
crcNoCheckit
=
set
;
}
inline
bool
isCRCNoCheckit
()
inline
bool
isCRCNoCheckit
()
const
{
return
crcNoCheckit
;
}
...
...
@@ -107,7 +107,7 @@ class ModbusServer
{
onBroadcast
=
set
;
}
inline
bool
getBroadcastMode
()
inline
bool
getBroadcastMode
()
const
{
return
onBroadcast
;
}
...
...
@@ -142,7 +142,7 @@ class ModbusServer
virtual
void
cleanupChannel
()
{}
virtual
void
terminate
()
{}
virtual
bool
isActive
()
=
0
;
virtual
bool
isActive
()
const
=
0
;
// ------------ Статистика ---------------
typedef
std
::
unordered_map
<
ModbusRTU
::
mbErrCode
,
size_t
>
ExchangeErrorMap
;
...
...
@@ -151,7 +151,7 @@ class ModbusServer
size_t
getErrCount
(
ModbusRTU
::
mbErrCode
e
);
size_t
resetErrCount
(
ModbusRTU
::
mbErrCode
e
,
size_t
set
=
0
);
inline
size_t
getAskCount
()
inline
size_t
getAskCount
()
const
{
return
askCount
;
}
...
...
include/modbus/ModbusTCPMaster.h
View file @
070f1f5b
...
...
@@ -22,7 +22,7 @@ class ModbusTCPMaster:
void
connect
(
ost
::
InetAddress
addr
,
int
port
);
void
disconnect
();
void
forceDisconnect
();
bool
isConnection
();
bool
isConnection
()
const
;
static
bool
checkConnection
(
const
std
::
string
&
ip
,
int
port
,
int
timeout_msec
=
100
);
...
...
@@ -39,11 +39,11 @@ class ModbusTCPMaster:
cleanInputStream
();
}
inline
std
::
string
getAddress
()
inline
std
::
string
getAddress
()
const
{
return
iaddr
;
}
inline
int
getPort
()
inline
int
getPort
()
const
{
return
port
;
}
...
...
include/modbus/ModbusTCPServer.h
View file @
070f1f5b
...
...
@@ -37,7 +37,7 @@ class ModbusTCPServer:
*/
void
run
(
const
std
::
unordered_set
<
ModbusRTU
::
ModbusAddr
>&
vmbaddr
,
bool
thread
=
false
);
virtual
bool
isActive
()
override
;
virtual
bool
isActive
()
const
override
;
void
setMaxSessions
(
size_t
num
);
inline
size_t
getMaxSessions
()
...
...
include/modbus/ModbusTCPSession.h
View file @
070f1f5b
...
...
@@ -45,7 +45,7 @@ class ModbusTCPSession:
void
connectFinalSession
(
FinalSlot
sl
);
inline
std
::
string
getClientAddress
()
inline
std
::
string
getClientAddress
()
const
{
return
caddr
;
}
...
...
@@ -55,7 +55,7 @@ class ModbusTCPSession:
// запуск обработки входящих запросов
void
run
(
ev
::
loop_ref
&
loop
);
virtual
bool
isActive
()
override
;
virtual
bool
isActive
()
const
override
;
void
iowait
(
timeout_t
msec
);
...
...
include/modbus/ModbusTypes.h
View file @
070f1f5b
This diff is collapsed.
Click to expand it.
src/Communications/Modbus/ModbusRTUSlave.cc
View file @
070f1f5b
...
...
@@ -139,7 +139,7 @@ void ModbusRTUSlave::terminate()
catch
(...)
{}
}
// -------------------------------------------------------------------------
bool
ModbusRTUSlave
::
isActive
()
bool
ModbusRTUSlave
::
isActive
()
const
{
return
false
;
}
...
...
src/Communications/Modbus/ModbusTCPMaster.cc
View file @
070f1f5b
...
...
@@ -459,7 +459,7 @@ void ModbusTCPMaster::forceDisconnect()
tcp
.
reset
();
}
// -------------------------------------------------------------------------
bool
ModbusTCPMaster
::
isConnection
()
bool
ModbusTCPMaster
::
isConnection
()
const
{
return
tcp
&&
tcp
->
isConnected
();
}
...
...
src/Communications/Modbus/ModbusTCPServer.cc
View file @
070f1f5b
...
...
@@ -83,7 +83,7 @@ void ModbusTCPServer::run( const std::unordered_set<ModbusAddr>& _vmbaddr, bool
evrun
(
thread
);
}
// -------------------------------------------------------------------------
bool
ModbusTCPServer
::
isActive
()
bool
ModbusTCPServer
::
isActive
()
const
{
return
evIsActive
();
}
...
...
src/Communications/Modbus/ModbusTCPSession.cc
View file @
070f1f5b
...
...
@@ -123,7 +123,7 @@ void ModbusTCPSession::run( ev::loop_ref& loop )
ioTimeout
.
start
(
sessTimeout
);
}
// -------------------------------------------------------------------------
bool
ModbusTCPSession
::
isActive
()
bool
ModbusTCPSession
::
isActive
()
const
{
return
io
.
is_active
();
}
...
...
src/Communications/Modbus/ModbusTypes.cc
View file @
070f1f5b
...
...
@@ -512,7 +512,7 @@ DataBits16::operator ModbusData()
return
mdata
();
}
// -------------------------------------------------------------------------
ModbusData
DataBits16
::
mdata
()
ModbusData
DataBits16
::
mdata
()
const
{
ModbusData
udata
=
0
;
...
...
@@ -618,7 +618,7 @@ bool ReadCoilRetMessage::addData( DataBits d )
return
true
;
}
// -------------------------------------------------------------------------
bool
ReadCoilRetMessage
::
getData
(
unsigned
char
dnum
,
DataBits
&
d
)
bool
ReadCoilRetMessage
::
getData
(
unsigned
char
dnum
,
DataBits
&
d
)
const
{
if
(
dnum
<
bcnt
)
{
...
...
@@ -663,7 +663,7 @@ ModbusMessage ReadCoilRetMessage::transport_msg()
return
std
::
move
(
mm
);
}
// -------------------------------------------------------------------------
size_t
ReadCoilRetMessage
::
szData
()
size_t
ReadCoilRetMessage
::
szData
()
const
{
// фактическое число данных + контрольная сумма
return
sizeof
(
bcnt
)
+
bcnt
+
szCRC
;
...
...
@@ -819,7 +819,7 @@ bool ReadInputStatusRetMessage::addData( DataBits d )
return
true
;
}
// -------------------------------------------------------------------------
bool
ReadInputStatusRetMessage
::
getData
(
unsigned
char
dnum
,
DataBits
&
d
)
bool
ReadInputStatusRetMessage
::
getData
(
unsigned
char
dnum
,
DataBits
&
d
)
const
{
if
(
dnum
<
bcnt
)
{
...
...
@@ -864,7 +864,7 @@ ModbusMessage ReadInputStatusRetMessage::transport_msg()
return
std
::
move
(
mm
);
}
// -------------------------------------------------------------------------
size_t
ReadInputStatusRetMessage
::
szData
()
size_t
ReadInputStatusRetMessage
::
szData
()
const
{
// фактическое число данных + контрольная сумма
return
sizeof
(
bcnt
)
+
bcnt
+
szCRC
;
...
...
@@ -1074,7 +1074,7 @@ ModbusMessage ReadOutputRetMessage::transport_msg()
return
std
::
move
(
mm
);
}
// -------------------------------------------------------------------------
size_t
ReadOutputRetMessage
::
szData
()
size_t
ReadOutputRetMessage
::
szData
()
const
{
// фактическое число данных + контрольная сумма
return
sizeof
(
bcnt
)
+
count
*
sizeof
(
ModbusData
)
+
szCRC
;
...
...
@@ -1455,12 +1455,12 @@ void ForceCoilsMessage::init( const ModbusMessage& m )
memcpy
(
&
crc
,
&
(
m
.
data
[
m
.
dlen
-
szCRC
]),
szCRC
);
}
// -------------------------------------------------------------------------
bool
ForceCoilsMessage
::
checkFormat
()
bool
ForceCoilsMessage
::
checkFormat
()
const
{
return
(
func
==
fnForceMultipleCoils
);
}
// -------------------------------------------------------------------------
size_t
ForceCoilsMessage
::
szData
()
size_t
ForceCoilsMessage
::
szData
()
const
{
return
szHead
()
+
bcnt
+
szCRC
;
}
...
...
@@ -1703,13 +1703,13 @@ void WriteOutputMessage::init( const ModbusMessage& m )
data
[
i
]
=
SWAPSHORT
(
data
[
i
]);
}
// -------------------------------------------------------------------------
bool
WriteOutputMessage
::
checkFormat
()
bool
WriteOutputMessage
::
checkFormat
()
const
{
// return ( quant*sizeof(ModbusData) == bcnt ) && ( func == fnWriteOutputRegisters );
return
(
(
bcnt
==
(
quant
*
sizeof
(
ModbusData
)))
&&
(
func
==
fnWriteOutputRegisters
)
);
}
// -------------------------------------------------------------------------
size_t
WriteOutputMessage
::
szData
()
size_t
WriteOutputMessage
::
szData
()
const
{
return
szHead
()
+
bcnt
+
szCRC
;
}
...
...
@@ -1899,12 +1899,12 @@ void ForceSingleCoilMessage::init( const ModbusMessage& m )
}
// -------------------------------------------------------------------------
bool
ForceSingleCoilMessage
::
checkFormat
()
bool
ForceSingleCoilMessage
::
checkFormat
()
const
{
return
(
func
==
fnForceSingleCoil
);
}
// -------------------------------------------------------------------------
size_t
ForceSingleCoilMessage
::
szData
()
size_t
ForceSingleCoilMessage
::
szData
()
const
{
return
szHead
()
+
sizeof
(
ModbusData
)
+
szCRC
;
}
...
...
@@ -2076,7 +2076,7 @@ bool WriteSingleOutputMessage::checkFormat()
return
(
(
func
==
fnWriteOutputSingleRegister
)
);
}
// -------------------------------------------------------------------------
size_t
WriteSingleOutputMessage
::
szData
()
size_t
WriteSingleOutputMessage
::
szData
()
const
{
return
szHead
()
+
sizeof
(
ModbusData
)
+
szCRC
;
}
...
...
@@ -2365,7 +2365,7 @@ ModbusMessage DiagnosticMessage::transport_msg()
return
std
::
move
(
mm
);
}
// -------------------------------------------------------------------------
size_t
DiagnosticMessage
::
szData
()
size_t
DiagnosticMessage
::
szData
()
const
{
// фактическое число данных + контрольная сумма
return
sizeof
(
subf
)
+
count
*
sizeof
(
ModbusData
)
+
szCRC
;
...
...
@@ -2496,7 +2496,7 @@ void MEIMessageRDI::init( const ModbusMessage& m )
memcpy
(
&
crc
,
&
(
m
.
data
[
m
.
dlen
-
szCRC
]),
szCRC
);
}
// -------------------------------------------------------------------------
bool
MEIMessageRDI
::
checkFormat
()
bool
MEIMessageRDI
::
checkFormat
()
const
{
return
(
type
==
0x0E
);
}
...
...
@@ -2696,7 +2696,7 @@ ModbusMessage MEIMessageRetRDI::transport_msg()
return
std
::
move
(
mm
);
}
// -------------------------------------------------------------------------
size_t
MEIMessageRetRDI
::
szData
()
size_t
MEIMessageRetRDI
::
szData
()
const
{
// заголовочные поля + фактическое число данных + контрольная сумма
return
6
+
bcnt
+
szCRC
;
...
...
@@ -2867,7 +2867,7 @@ ModbusMessage JournalCommandRetMessage::transport_msg()
return
std
::
move
(
mm
);
}
// -------------------------------------------------------------------------
size_t
JournalCommandRetMessage
::
szData
()
size_t
JournalCommandRetMessage
::
szData
()
const
{
// фактическое число данных + контрольная сумма
return
sizeof
(
bcnt
)
+
count
*
sizeof
(
ModbusData
)
+
szCRC
;
...
...
@@ -3052,7 +3052,7 @@ std::ostream& ModbusRTU::operator<<(std::ostream& os, SetDateTimeMessage* m )
return
os
<<
(
*
m
);
}
// -------------------------------------------------------------------------
bool
SetDateTimeMessage
::
checkFormat
()
bool
SetDateTimeMessage
::
checkFormat
()
const
{
/*
// Lav: проверка >=0 бессмысленна, потому что в типе данных Modbusbyte не могут храниться отрицательные числа
...
...
@@ -3207,7 +3207,7 @@ void RemoteServiceMessage::init( const ModbusMessage& m )
memcpy
(
&
crc
,
&
(
m
.
data
[
m
.
dlen
-
szCRC
]),
szCRC
);
}
// -------------------------------------------------------------------------
size_t
RemoteServiceMessage
::
szData
()
size_t
RemoteServiceMessage
::
szData
()
const
{
return
szHead
()
+
bcnt
+
szCRC
;
}
...
...
@@ -3264,7 +3264,7 @@ void RemoteServiceRetMessage::clear()
bcnt
=
0
;
}
// -------------------------------------------------------------------------
size_t
RemoteServiceRetMessage
::
szData
()
size_t
RemoteServiceRetMessage
::
szData
()
const
{
// фактическое число данных + контрольная сумма
return
sizeof
(
bcnt
)
+
count
*
sizeof
(
ModbusByte
)
+
szCRC
;
...
...
@@ -3314,7 +3314,7 @@ ReadFileRecordMessage& ReadFileRecordMessage::operator=( const ModbusMessage& m
return
*
this
;
}
// -------------------------------------------------------------------------
bool
ReadFileRecordMessage
::
checkFormat
()
bool
ReadFileRecordMessage
::
checkFormat
()
const
{
return
(
bcnt
>=
0x07
&&
bcnt
<=
0xF5
);
}
...
...
@@ -3352,7 +3352,7 @@ void ReadFileRecordMessage::init( const ModbusMessage& m )
}
}
// -------------------------------------------------------------------------
size_t
ReadFileRecordMessage
::
szData
()
size_t
ReadFileRecordMessage
::
szData
()
const
{
// фактическое число данных + контрольная сумма
return
sizeof
(
bcnt
)
+
count
*
sizeof
(
SubRequest
)
+
szCRC
;
...
...
@@ -3520,7 +3520,7 @@ size_t FileTransferRetMessage::getDataLen( const ModbusMessage& m )
return
(
size_t
)
m
.
data
[
0
];
}
// -----------------------------------------------------------------------
size_t
FileTransferRetMessage
::
szData
()
size_t
FileTransferRetMessage
::
szData
()
const
{
// фактическое число данных + контрольная сумма
return
sizeof
(
ModbusByte
)
*
2
+
sizeof
(
ModbusData
)
*
3
+
dlen
+
szCRC
;
...
...
src/Log/LogSession.cc
View file @
070f1f5b
...
...
@@ -551,13 +551,23 @@ LogSession::LogSessionCommand_Signal LogSession::signal_logsession_command()
return
m_command_sig
;
}
// ---------------------------------------------------------------------
void
LogSession
::
cancel
()
{
cancelled
=
true
;
}
// ---------------------------------------------------------------------
void
LogSession
::
setMaxBufSize
(
size_t
num
)
{
std
::
unique_lock
<
std
::
mutex
>
lk
(
logbuf_mutex
);
maxRecordsNum
=
num
;
}
// ---------------------------------------------------------------------
bool
LogSession
::
isAcive
()
size_t
LogSession
::
getMaxBufSize
()
const
{
return
maxRecordsNum
;
}
// ---------------------------------------------------------------------
bool
LogSession
::
isAcive
()
const
{
return
io
.
is_active
();
}
...
...
src/ObjectRepository/ObjectIndex.cc
View file @
070f1f5b
...
...
@@ -29,7 +29,7 @@ using namespace UniSetTypes;
//const std::string ObjectIndex::sepNode = ":";
// -----------------------------------------------------------------------------------------
string
ObjectIndex
::
getNameById
(
const
ObjectId
id
)
string
ObjectIndex
::
getNameById
(
const
ObjectId
id
)
const
{
return
getMapName
(
id
);
}
...
...
src/ObjectRepository/ObjectIndex_Array.cc
View file @
070f1f5b
...
...
@@ -47,7 +47,7 @@ ObjectIndex_Array::ObjectIndex_Array( const ObjectInfo* objectInfo ):
}
}
// -----------------------------------------------------------------------------------------
ObjectId
ObjectIndex_Array
::
getIdByName
(
const
string
&
name
)
ObjectId
ObjectIndex_Array
::
getIdByName
(
const
string
&
name
)
const
{
auto
it
=
mok
.
find
(
name
);
...
...
@@ -58,7 +58,7 @@ ObjectId ObjectIndex_Array::getIdByName( const string& name )
}
// -----------------------------------------------------------------------------------------
string
ObjectIndex_Array
::
getMapName
(
const
ObjectId
id
)
string
ObjectIndex_Array
::
getMapName
(
const
ObjectId
id
)
const
{
if
(
id
!=
UniSetTypes
::
DefaultObjectId
&&
id
>=
0
&&
id
<
maxId
)
return
objectInfo
[
id
].
repName
;
...
...
@@ -67,7 +67,7 @@ string ObjectIndex_Array::getMapName( const ObjectId id )
// throw OutOfRange("ObjectIndex_Array::getMapName OutOfRange");
}
// -----------------------------------------------------------------------------------------
string
ObjectIndex_Array
::
getTextName
(
const
ObjectId
id
)
string
ObjectIndex_Array
::
getTextName
(
const
ObjectId
id
)
const
{
if
(
id
!=
UniSetTypes
::
DefaultObjectId
&&
id
>=
0
&&
id
<
maxId
)
return
objectInfo
[
id
].
textName
;
...
...
@@ -82,7 +82,7 @@ std::ostream& operator<<(std::ostream& os, ObjectIndex_Array& oi )
}
// -----------------------------------------------------------------------------------------
std
::
ostream
&
ObjectIndex_Array
::
printMap
(
std
::
ostream
&
os
)
std
::
ostream
&
ObjectIndex_Array
::
printMap
(
std
::
ostream
&
os
)
const
{
auto
oind
=
uniset_conf
()
->
oind
;
...
...
@@ -101,7 +101,7 @@ std::ostream& ObjectIndex_Array::printMap( std::ostream& os )
return
os
;
}
// -----------------------------------------------------------------------------------------
const
ObjectInfo
*
ObjectIndex_Array
::
getObjectInfo
(
const
ObjectId
id
)
const
ObjectInfo
*
ObjectIndex_Array
::
getObjectInfo
(
const
ObjectId
id
)
const
{
if
(
id
!=
UniSetTypes
::
DefaultObjectId
&&
id
>=
0
&&
id
<
maxId
)
return
&
(
objectInfo
[
id
]);
...
...
@@ -109,7 +109,7 @@ const ObjectInfo* ObjectIndex_Array::getObjectInfo( const ObjectId id )
return
NULL
;
}
// -----------------------------------------------------------------------------------------
const
ObjectInfo
*
ObjectIndex_Array
::
getObjectInfo
(
const
std
::
string
&
name
)
const
ObjectInfo
*
ObjectIndex_Array
::
getObjectInfo
(
const
std
::
string
&
name
)
const
{
auto
it
=
mok
.
find
(
name
);
...
...
src/ObjectRepository/ObjectIndex_XML.cc
View file @
070f1f5b
...
...
@@ -24,7 +24,7 @@
using
namespace
UniSetTypes
;
using
namespace
std
;
// -----------------------------------------------------------------------------------------
ObjectIndex_XML
::
ObjectIndex_XML
(
const
string
&
xmlfile
,
in
t
minSize
)
:
ObjectIndex_XML
::
ObjectIndex_XML
(
const
string
&
xmlfile
,
size_
t
minSize
)
:
omap
(
minSize
)
{
shared_ptr
<
UniXML
>
xml
=
make_shared
<
UniXML
>
();
...
...
@@ -36,7 +36,7 @@ ObjectIndex_XML::ObjectIndex_XML( const string& xmlfile, int minSize ):
// catch(...){}
}
// -----------------------------------------------------------------------------------------
ObjectIndex_XML
::
ObjectIndex_XML
(
const
std
::
shared_ptr
<
UniXML
>&
xml
,
in
t
minSize
)
:
ObjectIndex_XML
::
ObjectIndex_XML
(
const
std
::
shared_ptr
<
UniXML
>&
xml
,
size_
t
minSize
)
:
omap
(
minSize
)
{
build
(
xml
);
...
...
@@ -46,7 +46,7 @@ ObjectIndex_XML::~ObjectIndex_XML()
{
}
// -----------------------------------------------------------------------------------------
ObjectId
ObjectIndex_XML
::
getIdByName
(
const
string
&
name
)
ObjectId
ObjectIndex_XML
::
getIdByName
(
const
string
&
name
)
const
{
auto
it
=
mok
.
find
(
name
);
...
...
@@ -56,7 +56,7 @@ ObjectId ObjectIndex_XML::getIdByName( const string& name )
return
DefaultObjectId
;
}
// -----------------------------------------------------------------------------------------
string
ObjectIndex_XML
::
getMapName
(
const
ObjectId
id
)
string
ObjectIndex_XML
::
getMapName
(
const
ObjectId
id
)
const
{
if
(
(
unsigned
)
id
<
omap
.
size
()
&&
(
unsigned
)
id
>
0
)
return
omap
[
id
].
repName
;
...
...
@@ -64,7 +64,7 @@ string ObjectIndex_XML::getMapName( const ObjectId id )
return
""
;
}
// -----------------------------------------------------------------------------------------
string
ObjectIndex_XML
::
getTextName
(
const
ObjectId
id
)
string
ObjectIndex_XML
::
getTextName
(
const
ObjectId
id
)
const
{
if
(
(
unsigned
)
id
<
omap
.
size
()
&&
(
unsigned
)
id
>
0
)
return
omap
[
id
].
textName
;
...
...
@@ -77,9 +77,9 @@ std::ostream& operator<<(std::ostream& os, ObjectIndex_XML& oi )
return
oi
.
printMap
(
os
);
}
// -----------------------------------------------------------------------------------------
std
::
ostream
&
ObjectIndex_XML
::
printMap
(
std
::
ostream
&
os
)
std
::
ostream
&
ObjectIndex_XML
::
printMap
(
std
::
ostream
&
os
)
const
{
cout
<<
"size: "
<<
omap
.
size
()
<<
endl
;
os
<<
"size: "
<<
omap
.
size
()
<<
endl
;
for
(
auto
it
=
omap
.
begin
();
it
!=
omap
.
end
();
++
it
)
{
...
...
@@ -272,7 +272,7 @@ unsigned int ObjectIndex_XML::read_nodes( const std::shared_ptr<UniXML>& xml, co
return
ind
;
}
// ------------------------------------------------------------------------------------------
const
ObjectInfo
*
ObjectIndex_XML
::
getObjectInfo
(
const
ObjectId
id
)
const
ObjectInfo
*
ObjectIndex_XML
::
getObjectInfo
(
const
ObjectId
id
)
const
{
if
(
(
unsigned
)
id
<
omap
.
size
()
&&
(
unsigned
)
id
>
0
)
return
&
omap
[
id
];
...
...
@@ -280,7 +280,7 @@ const ObjectInfo* ObjectIndex_XML::getObjectInfo( const ObjectId id )
return
NULL
;
}
// ------------------------------------------------------------------------------------------
const
ObjectInfo
*
ObjectIndex_XML
::
getObjectInfo
(
const
std
::
string
&
name
)
const
ObjectInfo
*
ObjectIndex_XML
::
getObjectInfo
(
const
std
::
string
&
name
)
const
{
auto
it
=
mok
.
find
(
name
);
...
...
src/ObjectRepository/ObjectIndex_idXML.cc
View file @
070f1f5b
...
...
@@ -43,7 +43,7 @@ ObjectIndex_idXML::~ObjectIndex_idXML()
{
}
// -----------------------------------------------------------------------------------------
ObjectId
ObjectIndex_idXML
::
getIdByName
(
const
string
&
name
)
ObjectId
ObjectIndex_idXML
::
getIdByName
(
const
string
&
name
)
const
{
auto
it
=
mok
.
find
(
name
);
...
...
@@ -53,7 +53,7 @@ ObjectId ObjectIndex_idXML::getIdByName( const string& name )
return
DefaultObjectId
;
}
// -----------------------------------------------------------------------------------------
string
ObjectIndex_idXML
::
getMapName
(
const
ObjectId
id
)
string
ObjectIndex_idXML
::
getMapName
(
const
ObjectId
id
)
const
{
auto
it
=
omap
.
find
(
id
);
...
...
@@ -63,7 +63,7 @@ string ObjectIndex_idXML::getMapName( const ObjectId id )
return
""
;
}
// -----------------------------------------------------------------------------------------
string
ObjectIndex_idXML
::
getTextName
(
const
ObjectId
id
)
string
ObjectIndex_idXML
::
getTextName
(
const
ObjectId
id
)
const
{
auto
it
=
omap
.
find
(
id
);
...
...
@@ -78,7 +78,7 @@ std::ostream& operator<<(std::ostream& os, ObjectIndex_idXML& oi )
return
oi
.
printMap
(
os
);
}
// -----------------------------------------------------------------------------------------
std
::
ostream
&
ObjectIndex_idXML
::
printMap
(
std
::
ostream
&
os
)
std
::
ostream
&
ObjectIndex_idXML
::
printMap
(
std
::
ostream
&
os
)
const
{
os
<<
"size: "
<<
omap
.
size
()
<<
endl
;
...
...
@@ -235,7 +235,7 @@ void ObjectIndex_idXML::read_nodes( const std::shared_ptr<UniXML>& xml, const st
}
}
// ------------------------------------------------------------------------------------------
const
ObjectInfo
*
ObjectIndex_idXML
::
getObjectInfo
(
const
ObjectId
id
)
const
ObjectInfo
*
ObjectIndex_idXML
::
getObjectInfo
(
const
ObjectId
id
)
const
{
auto
it
=
omap
.
find
(
id
);
...
...
@@ -245,7 +245,7 @@ const ObjectInfo* ObjectIndex_idXML::getObjectInfo( const ObjectId id )
return
NULL
;
}
// ------------------------------------------------------------------------------------------
const
ObjectInfo
*
ObjectIndex_idXML
::
getObjectInfo
(
const
std
::
string
&
name
)
const
ObjectInfo
*
ObjectIndex_idXML
::
getObjectInfo
(
const
std
::
string
&
name
)
const
{
auto
it
=
mok
.
find
(
name
);
...
...
src/Processes/EventLoopServer.cc
View file @
070f1f5b
...
...
@@ -32,7 +32,7 @@ void EventLoopServer::evrun( bool thread )
thr
=
make_shared
<
std
::
thread
>
(
[
=
]
{
defaultLoop
();
}
);
}
// ---------------------------------------------------------------------------
bool
EventLoopServer
::
evIsActive
()
bool
EventLoopServer
::
evIsActive
()
const
{
return
isrunning
;
}
...
...
src/Various/LT_Object.cc
View file @
070f1f5b
...
...
@@ -137,7 +137,7 @@ timeout_t LT_Object::getTimeInterval( TimerId timerid )
return
0
;
}
// ------------------------------------------------------------------------------------------
timeout_t
LT_Object
::
getTimeLeft
(
TimerId
timerid
)
timeout_t
LT_Object
::
getTimeLeft
(
TimerId
timerid
)
{
// lock
uniset_rwmutex_rlock
lock
(
lstMutex
);
...
...
src/Various/MQAtomic.cc
View file @
070f1f5b
...
...
@@ -115,7 +115,7 @@ VoidMessagePtr MQAtomic::top()
return
nullptr
;
}
//---------------------------------------------------------------------------
size_t
MQAtomic
::
size
()
size_t
MQAtomic
::
size
()
const
{
// т.к. rpos корректируется только при фактическом вызое top()
// то тут приходиться смотреть если у нас переполнение
...
...
@@ -127,7 +127,7 @@ size_t MQAtomic::size()
return
(
qpos
-
rpos
);
}
//---------------------------------------------------------------------------
bool
MQAtomic
::
empty
()
bool
MQAtomic
::
empty
()
const
{
return
(
qpos
==
rpos
);
}
...
...
@@ -141,7 +141,7 @@ void MQAtomic::setMaxSizeOfMessageQueue( size_t s )
}
}
//---------------------------------------------------------------------------
size_t
MQAtomic
::
getMaxSizeOfMessageQueue
()
size_t
MQAtomic
::
getMaxSizeOfMessageQueue
()
const
{
return
SizeOfMessageQueue
;
}
...
...
src/Various/MQMutex.cc
View file @
070f1f5b
...
...
@@ -82,7 +82,7 @@ void MQMutex::setMaxSizeOfMessageQueue( size_t s )
SizeOfMessageQueue
=
s
;
}
//---------------------------------------------------------------------------
size_t
MQMutex
::
getMaxSizeOfMessageQueue
()
size_t
MQMutex
::
getMaxSizeOfMessageQueue
()
const
{
return
SizeOfMessageQueue
;
}
...
...
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