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
e77133e0
Commit
e77133e0
authored
Jul 13, 2017
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Рефакторинг: расстановка const, перенос реализации из h-файлов
parent
f2e95a15
Hide whitespace changes
Inline
Side-by-side
Showing
33 changed files
with
295 additions
and
213 deletions
+295
-213
ctl-cpp-common.xsl
Utilities/codegen/ctl-cpp-common.xsl
+2
-2
SharedMemory.cc
extensions/SharedMemory/SharedMemory.cc
+1
-1
UObject_SK.h
extensions/include/UObject_SK.h
+2
-2
UObject_SK.cc
extensions/lib/UObject_SK.cc
+2
-2
ComPort.h
include/ComPort.h
+2
-8
IOController.h
include/IOController.h
+4
-5
LT_Object.h
include/LT_Object.h
+1
-1
LogReader.h
include/LogReader.h
+7
-30
LogServer.h
include/LogServer.h
+5
-21
LogServerTypes.h
include/LogServerTypes.h
+4
-3
LogSession.h
include/LogSession.h
+5
-17
ObjectIndex.h
include/ObjectIndex.h
+2
-8
ObjectRepository.h
include/ObjectRepository.h
+4
-4
ThreadCreator.h
include/ThreadCreator.h
+2
-2
ModbusRTUMaster.h
include/modbus/ModbusRTUMaster.h
+2
-5
ModbusServer.h
include/modbus/ModbusServer.h
+9
-33
ModbusTCPMaster.h
include/modbus/ModbusTCPMaster.h
+4
-16
ModbusTCPServer.h
include/modbus/ModbusTCPServer.h
+10
-31
ModbusTCPSession.h
include/modbus/ModbusTCPSession.h
+1
-4
ComPort.cc
src/Communications/ComPort.cc
+10
-0
ModbusRTUMaster.cc
src/Communications/Modbus/ModbusRTUMaster.cc
+7
-1
ModbusServer.cc
src/Communications/Modbus/ModbusServer.cc
+41
-1
ModbusTCPMaster.cc
src/Communications/Modbus/ModbusTCPMaster.cc
+20
-0
ModbusTCPServer.cc
src/Communications/Modbus/ModbusTCPServer.cc
+36
-1
ModbusTCPSession.cc
src/Communications/Modbus/ModbusTCPSession.cc
+5
-0
LogReader.cc
src/Log/LogReader.cc
+35
-0
LogServer.cc
src/Log/LogServer.cc
+25
-0
LogSession.cc
src/Log/LogSession.cc
+20
-0
ObjectIndex.cc
src/ObjectRepository/ObjectIndex.cc
+10
-0
ObjectRepository.cc
src/ObjectRepository/ObjectRepository.cc
+4
-4
IOController.cc
src/Processes/IOController.cc
+0
-5
Configuration.cc
src/Various/Configuration.cc
+11
-4
LT_Object.cc
src/Various/LT_Object.cc
+2
-2
No files found.
Utilities/codegen/ctl-cpp-common.xsl
View file @
e77133e0
...
@@ -252,7 +252,7 @@
...
@@ -252,7 +252,7 @@
/*! Вывод состояния внутренних переменных */
/*! Вывод состояния внутренних переменных */
inline std::string dumpVars(){ return vmon.pretty_str(); }
inline std::string dumpVars(){ return vmon.pretty_str(); }
// ------------------------------------------------------------
// ------------------------------------------------------------
std::string help() noexcept;
std::string help()
const
noexcept;
<xsl:if
test=
"normalize-space($DISABLE_REST_API)!='1'"
>
<xsl:if
test=
"normalize-space($DISABLE_REST_API)!='1'"
>
#ifndef DISABLE_REST_API
#ifndef DISABLE_REST_API
...
@@ -869,7 +869,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::waitSM( int wait_msec, ObjectId _te
...
@@ -869,7 +869,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::waitSM( int wait_msec, ObjectId _te
}
}
}
}
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
std::string
<xsl:value-of
select=
"$CLASSNAME"
/>
_SK::help() noexcept
std::string
<xsl:value-of
select=
"$CLASSNAME"
/>
_SK::help()
const
noexcept
{
{
ostringstream s;
ostringstream s;
s
<<
" ************* "
<<
myname
<<
" HELP:"
<<
" ************* "
<<
endl;
s
<<
" ************* "
<<
myname
<<
" HELP:"
<<
" ************* "
<<
endl;
...
...
extensions/SharedMemory/SharedMemory.cc
View file @
e77133e0
...
@@ -587,7 +587,7 @@ namespace uniset
...
@@ -587,7 +587,7 @@ namespace uniset
bool
ok
=
false
;
bool
ok
=
false
;
tm
.
consumer
=
it
;
tm
.
consumer
=
it
;
for
(
unsigned
in
t
i
=
0
;
i
<
2
;
i
++
)
for
(
size_
t
i
=
0
;
i
<
2
;
i
++
)
{
{
try
try
{
{
...
...
extensions/include/UObject_SK.h
View file @
e77133e0
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
ВСЕ ВАШИ ИЗМЕНЕНИЯ БУДУТ ПОТЕРЯНЫ.
ВСЕ ВАШИ ИЗМЕНЕНИЯ БУДУТ ПОТЕРЯНЫ.
*/
*/
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
// generate timestamp: 2017-07-
02
+03:00
// generate timestamp: 2017-07-
13
+03:00
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
#ifndef UObject_SK_H_
#ifndef UObject_SK_H_
#define UObject_SK_H_
#define UObject_SK_H_
...
@@ -118,7 +118,7 @@ class UObject_SK:
...
@@ -118,7 +118,7 @@ class UObject_SK:
/*! Вывод состояния внутренних переменных */
/*! Вывод состояния внутренних переменных */
inline
std
::
string
dumpVars
(){
return
vmon
.
pretty_str
();
}
inline
std
::
string
dumpVars
(){
return
vmon
.
pretty_str
();
}
// ------------------------------------------------------------
// ------------------------------------------------------------
std
::
string
help
()
noexcept
;
std
::
string
help
()
const
noexcept
;
#ifndef DISABLE_REST_API
#ifndef DISABLE_REST_API
...
...
extensions/lib/UObject_SK.cc
View file @
e77133e0
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
ВСЕ ВАШИ ИЗМЕНЕНИЯ БУДУТ ПОТЕРЯНЫ.
ВСЕ ВАШИ ИЗМЕНЕНИЯ БУДУТ ПОТЕРЯНЫ.
*/
*/
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
// generate timestamp: 2017-07-
02
+03:00
// generate timestamp: 2017-07-
13
+03:00
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
#include <memory>
#include <memory>
#include <iomanip>
#include <iomanip>
...
@@ -717,7 +717,7 @@ void UObject_SK::waitSM( int wait_msec, ObjectId _testID )
...
@@ -717,7 +717,7 @@ void UObject_SK::waitSM( int wait_msec, ObjectId _testID )
}
}
}
}
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
std
::
string
UObject_SK
::
help
()
noexcept
std
::
string
UObject_SK
::
help
()
const
noexcept
{
{
ostringstream
s
;
ostringstream
s
;
s
<<
" ************* "
<<
myname
<<
" HELP:"
<<
" ************* "
<<
endl
;
s
<<
" ************* "
<<
myname
<<
" HELP:"
<<
" ************* "
<<
endl
;
...
...
include/ComPort.h
View file @
e77133e0
...
@@ -95,10 +95,7 @@ namespace uniset
...
@@ -95,10 +95,7 @@ namespace uniset
void
setSpeed
(
Speed
s
);
void
setSpeed
(
Speed
s
);
void
setSpeed
(
const
std
::
string
&
speed
);
void
setSpeed
(
const
std
::
string
&
speed
);
inline
Speed
getSpeed
()
Speed
getSpeed
()
const
;
{
return
speed
;
}
static
Speed
getSpeed
(
const
std
::
string
&
s
);
static
Speed
getSpeed
(
const
std
::
string
&
s
);
static
std
::
string
getSpeed
(
Speed
s
);
static
std
::
string
getSpeed
(
Speed
s
);
...
@@ -108,10 +105,7 @@ namespace uniset
...
@@ -108,10 +105,7 @@ namespace uniset
void
setStopBits
(
StopBits
sBit
);
void
setStopBits
(
StopBits
sBit
);
virtual
void
setTimeout
(
timeout_t
msec
);
virtual
void
setTimeout
(
timeout_t
msec
);
inline
timeout_t
getTimeout
()
timeout_t
getTimeout
()
const
;
{
return
uTimeout
/
1000
;
// msec
}
void
setWaiting
(
bool
waiting
);
void
setWaiting
(
bool
waiting
);
...
...
include/IOController.h
View file @
e77133e0
...
@@ -150,7 +150,8 @@ namespace uniset
...
@@ -150,7 +150,8 @@ namespace uniset
{
{
return
ioList
.
find
(
k
);
return
ioList
.
find
(
k
);
}
}
inline
int
ioCount
()
const
inline
int
ioCount
()
const
noexcept
{
{
return
ioList
.
size
();
return
ioList
.
size
();
}
}
...
@@ -250,8 +251,6 @@ namespace uniset
...
@@ -250,8 +251,6 @@ namespace uniset
IOStateList
::
iterator
myioBegin
();
IOStateList
::
iterator
myioBegin
();
IOStateList
::
iterator
myioEnd
();
IOStateList
::
iterator
myioEnd
();
IOStateList
::
iterator
myiofind
(
uniset
::
ObjectId
id
);
IOStateList
::
iterator
myiofind
(
uniset
::
ObjectId
id
);
size_t
ioCount
();
// --------------------------
private
:
private
:
friend
class
NCRestorer
;
friend
class
NCRestorer
;
...
@@ -338,7 +337,7 @@ namespace uniset
...
@@ -338,7 +337,7 @@ namespace uniset
{
{
uniset
::
uniset_rwmutex_rlock
lock
(
val_lock
);
uniset
::
uniset_rwmutex_rlock
lock
(
val_lock
);
IOController_i
::
SensorIOInfo
s
(
*
this
);
IOController_i
::
SensorIOInfo
s
(
*
this
);
return
s
td
::
move
(
s
)
;
return
s
;
}
}
inline
uniset
::
SensorMessage
makeSensorMessage
(
bool
with_lock
=
false
)
inline
uniset
::
SensorMessage
makeSensorMessage
(
bool
with_lock
=
false
)
...
@@ -370,7 +369,7 @@ namespace uniset
...
@@ -370,7 +369,7 @@ namespace uniset
sm
.
undefined
=
undefined
;
sm
.
undefined
=
undefined
;
}
}
return
s
td
::
move
(
sm
)
;
return
s
m
;
}
}
};
};
};
};
...
...
include/LT_Object.h
View file @
e77133e0
...
@@ -72,7 +72,7 @@ namespace uniset
...
@@ -72,7 +72,7 @@ namespace uniset
sleepTime=lt.checkTimers(this);
sleepTime=lt.checkTimers(this);
}
}
catch(
Exception& ex)
catch( uniset::
Exception& ex)
{
{
cout << myname << "(callback): " << ex << endl;
cout << myname << "(callback): " << ex << endl;
}
}
...
...
include/LogReader.h
View file @
e77133e0
...
@@ -52,42 +52,19 @@ namespace uniset
...
@@ -52,42 +52,19 @@ namespace uniset
bool
isConnection
()
const
;
bool
isConnection
()
const
;
inline
void
setReadCount
(
unsigned
int
n
)
void
setReadCount
(
unsigned
int
n
);
{
void
setCommandOnlyMode
(
bool
s
);
readcount
=
n
;
}
inline
void
setCommandOnlyMode
(
bool
s
)
void
setinTimeout
(
timeout_t
msec
);
{
void
setoutTimeout
(
timeout_t
msec
);
cmdonly
=
s
;
void
setReconnectDelay
(
timeout_t
msec
);
}
void
setTextFilter
(
const
std
::
string
&
f
);
inline
void
setinTimeout
(
timeout_t
msec
)
{
inTimeout
=
msec
;
}
inline
void
setoutTimeout
(
timeout_t
msec
)
{
outTimeout
=
msec
;
}
inline
void
setReconnectDelay
(
timeout_t
msec
)
{
reconDelay
=
msec
;
}
inline
void
setTextFilter
(
const
std
::
string
&
f
)
{
textfilter
=
f
;
}
DebugStream
::
StreamEvent_Signal
signal_stream_event
();
DebugStream
::
StreamEvent_Signal
signal_stream_event
();
void
setLogLevel
(
Debug
::
type
t
);
void
setLogLevel
(
Debug
::
type
t
);
inline
std
::
shared_ptr
<
DebugStream
>
log
()
std
::
shared_ptr
<
DebugStream
>
log
();
{
return
outlog
;
}
protected
:
protected
:
...
...
include/LogServer.h
View file @
e77133e0
...
@@ -98,29 +98,16 @@ namespace uniset
...
@@ -98,29 +98,16 @@ namespace uniset
LogServer
(
std
::
shared_ptr
<
LogAgregator
>
log
);
LogServer
(
std
::
shared_ptr
<
LogAgregator
>
log
);
virtual
~
LogServer
()
noexcept
;
virtual
~
LogServer
()
noexcept
;
inline
void
setCmdTimeout
(
timeout_t
msec
)
noexcept
void
setCmdTimeout
(
timeout_t
msec
)
noexcept
;
{
void
setSessionLog
(
Debug
::
type
t
)
noexcept
;
cmdTimeout
=
msec
;
void
setMaxSessionCount
(
size_t
num
)
noexcept
;
}
inline
void
setSessionLog
(
Debug
::
type
t
)
noexcept
{
sessLogLevel
=
t
;
}
inline
void
setMaxSessionCount
(
int
num
)
noexcept
{
sessMaxCount
=
num
;
}
bool
async_run
(
const
std
::
string
&
addr
,
Poco
::
UInt16
port
);
bool
async_run
(
const
std
::
string
&
addr
,
Poco
::
UInt16
port
);
bool
run
(
const
std
::
string
&
addr
,
Poco
::
UInt16
port
);
bool
run
(
const
std
::
string
&
addr
,
Poco
::
UInt16
port
);
void
terminate
();
void
terminate
();
inline
bool
isRunning
()
const
noexcept
bool
isRunning
()
const
noexcept
;
{
return
isrunning
;
}
bool
check
(
bool
restart_if_fail
=
true
);
bool
check
(
bool
restart_if_fail
=
true
);
...
@@ -139,10 +126,7 @@ namespace uniset
...
@@ -139,10 +126,7 @@ namespace uniset
virtual
void
evprepare
(
const
ev
::
loop_ref
&
loop
)
override
;
virtual
void
evprepare
(
const
ev
::
loop_ref
&
loop
)
override
;
virtual
void
evfinish
(
const
ev
::
loop_ref
&
loop
)
override
;
virtual
void
evfinish
(
const
ev
::
loop_ref
&
loop
)
override
;
virtual
std
::
string
wname
()
const
noexcept
override
virtual
std
::
string
wname
()
const
noexcept
override
;
{
return
myname
;
}
void
ioAccept
(
ev
::
io
&
watcher
,
int
revents
);
void
ioAccept
(
ev
::
io
&
watcher
,
int
revents
);
void
sessionFinished
(
LogSession
*
s
);
void
sessionFinished
(
LogSession
*
s
);
...
...
include/LogServerTypes.h
View file @
e77133e0
...
@@ -25,7 +25,7 @@ namespace uniset
...
@@ -25,7 +25,7 @@ namespace uniset
namespace
LogServerTypes
namespace
LogServerTypes
{
{
const
u
nsigned
int
MAGICNUM
=
0x20160417
;
const
uint
MAGICNUM
=
0x20160417
;
enum
Command
enum
Command
{
{
cmdNOP
,
/*!< отсутствие команды */
cmdNOP
,
/*!< отсутствие команды */
...
@@ -55,9 +55,10 @@ namespace uniset
...
@@ -55,9 +55,10 @@ namespace uniset
{
{
std
::
memset
(
logname
,
0
,
sizeof
(
logname
));
std
::
memset
(
logname
,
0
,
sizeof
(
logname
));
}
}
unsigned
int
magic
;
uint
magic
;
Command
cmd
;
Command
cmd
;
u
nsigned
int
data
;
uint
data
;
static
const
size_t
MAXLOGNAME
=
120
;
static
const
size_t
MAXLOGNAME
=
120
;
char
logname
[
MAXLOGNAME
+
1
];
// +1 reserverd for '\0'
char
logname
[
MAXLOGNAME
+
1
];
// +1 reserverd for '\0'
...
...
include/LogSession.h
View file @
e77133e0
...
@@ -53,23 +53,11 @@ namespace uniset
...
@@ -53,23 +53,11 @@ namespace uniset
// прервать работу
// прервать работу
void
cancel
()
noexcept
;
void
cancel
()
noexcept
;
inline
std
::
string
getClientAddress
()
const
noexcept
std
::
string
getClientAddress
()
const
noexcept
;
{
return
caddr
;
void
setSessionLogLevel
(
Debug
::
type
t
)
noexcept
;
}
void
addSessionLogLevel
(
Debug
::
type
t
)
noexcept
;
void
delSessionLogLevel
(
Debug
::
type
t
)
noexcept
;
inline
void
setSessionLogLevel
(
Debug
::
type
t
)
noexcept
{
mylog
.
level
(
t
);
}
inline
void
addSessionLogLevel
(
Debug
::
type
t
)
noexcept
{
mylog
.
addLevel
(
t
);
}
inline
void
delSessionLogLevel
(
Debug
::
type
t
)
noexcept
{
mylog
.
delLevel
(
t
);
}
//! Установить размер буфера для сообщений (количество записей. Не в байтах!!)
//! Установить размер буфера для сообщений (количество записей. Не в байтах!!)
void
setMaxBufSize
(
size_t
num
);
void
setMaxBufSize
(
size_t
num
);
...
...
include/ObjectIndex.h
View file @
e77133e0
...
@@ -50,16 +50,10 @@ namespace uniset
...
@@ -50,16 +50,10 @@ namespace uniset
// node
// node
//! \return "" if not found
//! \return "" if not found
inline
std
::
string
getNodeName
(
const
uniset
::
ObjectId
id
)
const
noexcept
std
::
string
getNodeName
(
const
uniset
::
ObjectId
id
)
const
noexcept
;
{
return
getNameById
(
id
);
}
//! \return uniset::DefaultObjectId if not found
//! \return uniset::DefaultObjectId if not found
inline
ObjectId
getNodeId
(
const
std
::
string
&
name
)
const
noexcept
ObjectId
getNodeId
(
const
std
::
string
&
name
)
const
noexcept
;
{
return
getIdByName
(
name
);
}
// src name
// src name
//! \return "" if not found
//! \return "" if not found
...
...
include/ObjectRepository.h
View file @
e77133e0
...
@@ -88,10 +88,10 @@ namespace uniset
...
@@ -88,10 +88,10 @@ namespace uniset
};
};
//! Получение списка how_many объектов из секции section.
//! Получение списка how_many объектов из секции section.
bool
list
(
const
std
::
string
&
section
,
uniset
::
ListObjectName
*
ls
,
size_t
how_many
=
300
)
throw
(
uniset
::
ORepFailed
);
bool
list
(
const
std
::
string
&
section
,
uniset
::
ListObjectName
*
ls
,
size_t
how_many
=
300
)
const
throw
(
uniset
::
ORepFailed
);
//! Получние списка how_many подсекций из секции in_section.
//! Получние списка how_many подсекций из секции in_section.
bool
listSections
(
const
std
::
string
&
in_section
,
uniset
::
ListObjectName
*
ls
,
size_t
how_many
=
300
)
throw
(
uniset
::
ORepFailed
);
bool
listSections
(
const
std
::
string
&
in_section
,
uniset
::
ListObjectName
*
ls
,
size_t
how_many
=
300
)
const
throw
(
uniset
::
ORepFailed
);
// -------------------------------------------------------------------
// -------------------------------------------------------------------
//! Создание секции
//! Создание секции
...
@@ -110,7 +110,7 @@ namespace uniset
...
@@ -110,7 +110,7 @@ namespace uniset
bool
renameSection
(
const
std
::
string
&
newName
,
const
std
::
string
&
fullName
);
bool
renameSection
(
const
std
::
string
&
newName
,
const
std
::
string
&
fullName
);
/*! Функция выводящая на экран список всех объектов расположенных в данной секции */
/*! Функция выводящая на экран список всех объектов расположенных в данной секции */
void
printSection
(
const
std
::
string
&
fullName
);
void
printSection
(
const
std
::
string
&
fullName
)
const
;
// @}
// @}
// end of add to ORepServiceGroup
// end of add to ORepServiceGroup
...
@@ -121,7 +121,7 @@ namespace uniset
...
@@ -121,7 +121,7 @@ namespace uniset
mutable
std
::
string
nsName
;
mutable
std
::
string
nsName
;
std
::
shared_ptr
<
uniset
::
Configuration
>
uconf
;
std
::
shared_ptr
<
uniset
::
Configuration
>
uconf
;
bool
list
(
const
std
::
string
&
section
,
uniset
::
ListObjectName
*
ls
,
unsigned
int
how_many
,
ObjectType
type
);
bool
list
(
const
std
::
string
&
section
,
uniset
::
ListObjectName
*
ls
,
unsigned
int
how_many
,
ObjectType
type
)
const
;
/*! Создание нового контекста(секции) */
/*! Создание нового контекста(секции) */
bool
createContext
(
const
std
::
string
&
cname
,
CosNaming
::
NamingContext_ptr
ctx
);
bool
createContext
(
const
std
::
string
&
cname
,
CosNaming
::
NamingContext_ptr
ctx
);
...
...
include/ThreadCreator.h
View file @
e77133e0
...
@@ -90,7 +90,7 @@ namespace uniset
...
@@ -90,7 +90,7 @@ namespace uniset
public
:
public
:
/*! прототип функции вызова
/*! прототип функции вызова
* use std::function ?
*
\todo
use std::function ?
*/
*/
typedef
void
(
ThreadMaster
::*
Action
)(
void
);
typedef
void
(
ThreadMaster
::*
Action
)(
void
);
...
@@ -113,7 +113,7 @@ namespace uniset
...
@@ -113,7 +113,7 @@ namespace uniset
void
sleep
(
long
milliseconds
);
void
sleep
(
long
milliseconds
);
inline
bool
isRunning
()
inline
bool
isRunning
()
const
{
{
return
thr
.
isRunning
();
return
thr
.
isRunning
();
}
}
...
...
include/modbus/ModbusRTUMaster.h
View file @
e77133e0
...
@@ -26,10 +26,7 @@ namespace uniset
...
@@ -26,10 +26,7 @@ namespace uniset
ModbusRTUMaster
(
const
std
::
string
&
dev
,
bool
use485
=
false
,
bool
tr_ctl
=
false
);
ModbusRTUMaster
(
const
std
::
string
&
dev
,
bool
use485
=
false
,
bool
tr_ctl
=
false
);
virtual
~
ModbusRTUMaster
();
virtual
~
ModbusRTUMaster
();
virtual
void
cleanupChannel
()
override
virtual
void
cleanupChannel
()
override
;
{
if
(
port
)
port
->
cleanupChannel
();
}
void
setSpeed
(
ComPort
::
Speed
s
);
void
setSpeed
(
ComPort
::
Speed
s
);
void
setSpeed
(
const
std
::
string
&
s
);
void
setSpeed
(
const
std
::
string
&
s
);
...
@@ -39,7 +36,7 @@ namespace uniset
...
@@ -39,7 +36,7 @@ namespace uniset
void
setCharacterSize
(
ComPort
::
CharacterSize
csize
);
void
setCharacterSize
(
ComPort
::
CharacterSize
csize
);
void
setStopBits
(
ComPort
::
StopBits
sBit
);
void
setStopBits
(
ComPort
::
StopBits
sBit
);
int
getTimeout
()
;
timeout_t
getTimeout
()
const
;
protected
:
protected
:
...
...
include/modbus/ModbusServer.h
View file @
e77133e0
...
@@ -92,37 +92,16 @@ namespace uniset
...
@@ -92,37 +92,16 @@ namespace uniset
void
setRecvTimeout
(
timeout_t
msec
);
void
setRecvTimeout
(
timeout_t
msec
);
/*! установить паузу при ожидании символа */
/*! установить паузу при ожидании символа */
inline
void
setSleepPause
(
timeout_t
msec
)
void
setSleepPause
(
timeout_t
msec
);
{
sleepPause_msec
=
msec
;
}
inline
void
setCRCNoCheckit
(
bool
set
)
void
setCRCNoCheckit
(
bool
set
);
{
bool
isCRCNoCheckit
()
const
;
crcNoCheckit
=
set
;
}
inline
bool
isCRCNoCheckit
()
const
{
return
crcNoCheckit
;
}
inline
void
setBroadcastMode
(
bool
set
)
void
setBroadcastMode
(
bool
set
);
{
bool
getBroadcastMode
()
const
;
onBroadcast
=
set
;
}
inline
bool
getBroadcastMode
()
const
{
return
onBroadcast
;
}
inline
void
setCleanBeforeSend
(
bool
set
)
void
setCleanBeforeSend
(
bool
set
);
{
bool
getCleanBeforeSend
()
const
;
cleanBeforeSend
=
set
;
}
inline
bool
getCleanBeforeSend
()
{
return
cleanBeforeSend
;
}
/*! Вспомогательная функция реализующая обработку запроса на установку времени.
/*! Вспомогательная функция реализующая обработку запроса на установку времени.
Основана на использовании gettimeofday и settimeofday.
Основана на использовании gettimeofday и settimeofday.
...
@@ -151,13 +130,10 @@ namespace uniset
...
@@ -151,13 +130,10 @@ namespace uniset
typedef
std
::
unordered_map
<
ModbusRTU
::
mbErrCode
,
size_t
>
ExchangeErrorMap
;
typedef
std
::
unordered_map
<
ModbusRTU
::
mbErrCode
,
size_t
>
ExchangeErrorMap
;
ExchangeErrorMap
getErrorMap
();
ExchangeErrorMap
getErrorMap
();
size_t
getErrCount
(
ModbusRTU
::
mbErrCode
e
);
size_t
getErrCount
(
ModbusRTU
::
mbErrCode
e
)
const
;
size_t
resetErrCount
(
ModbusRTU
::
mbErrCode
e
,
size_t
set
=
0
);
size_t
resetErrCount
(
ModbusRTU
::
mbErrCode
e
,
size_t
set
=
0
);
inline
size_t
getAskCount
()
const
size_t
getAskCount
()
const
;
{
return
askCount
;
}
void
resetAskCounter
();
void
resetAskCounter
();
protected
:
protected
:
...
...
include/modbus/ModbusTCPMaster.h
View file @
e77133e0
...
@@ -30,27 +30,15 @@ namespace uniset
...
@@ -30,27 +30,15 @@ namespace uniset
static
bool
checkConnection
(
const
std
::
string
&
ip
,
int
port
,
int
timeout_msec
=
100
);
static
bool
checkConnection
(
const
std
::
string
&
ip
,
int
port
,
int
timeout_msec
=
100
);
inline
void
setForceDisconnect
(
bool
s
)
void
setForceDisconnect
(
bool
s
);
{
force_disconnect
=
s
;
}
bool
reconnect
();
bool
reconnect
();
void
cleanInputStream
();
void
cleanInputStream
();
virtual
void
cleanupChannel
()
override
virtual
void
cleanupChannel
()
override
;
{
cleanInputStream
();
}
inline
std
::
string
getAddress
()
const
std
::
string
getAddress
()
const
;
{
int
getPort
()
const
;
return
iaddr
;
}
inline
int
getPort
()
const
{
return
port
;
}
void
setReadTimeout
(
timeout_t
msec
);
void
setReadTimeout
(
timeout_t
msec
);
timeout_t
getReadTimeout
()
const
;
timeout_t
getReadTimeout
()
const
;
...
...
include/modbus/ModbusTCPServer.h
View file @
e77133e0
...
@@ -51,51 +51,33 @@ namespace uniset
...
@@ -51,51 +51,33 @@ namespace uniset
virtual
bool
isActive
()
const
override
;
virtual
bool
isActive
()
const
override
;
void
setMaxSessions
(
size_t
num
);
void
setMaxSessions
(
size_t
num
);
inline
size_t
getMaxSessions
()
size_t
getMaxSessions
()
const
;
{
return
maxSessions
;
}
/*! установить timeout для поддержания соединения с "клиентом" (Default: 10 сек) */
/*! установить timeout для поддержания соединения с "клиентом" (Default: 10 сек) */
void
setSessionTimeout
(
timeout_t
msec
);
void
setSessionTimeout
(
timeout_t
msec
);
inline
timeout_t
getSessionTimeout
()
timeout_t
getSessionTimeout
()
const
;
{
return
sessTimeout
;
}
/*! текущее количество подключений */
/*! текущее количество подключений */
size_t
getCountSessions
();
size_t
getCountSessions
()
const
;
inline
void
setIgnoreAddrMode
(
bool
st
)
void
setIgnoreAddrMode
(
bool
st
);
{
bool
getIgnoreAddrMode
()
const
;
ignoreAddr
=
st
;
}
inline
bool
getIgnoreAddrMode
()
{
return
ignoreAddr
;
}
// Сбор статистики по соединениям...
// Сбор статистики по соединениям...
struct
SessionInfo
struct
SessionInfo
{
{
SessionInfo
(
const
std
::
string
&
a
,
unsigned
in
t
ask
)
:
iaddr
(
a
),
askCount
(
ask
)
{}
SessionInfo
(
const
std
::
string
&
a
,
size_
t
ask
)
:
iaddr
(
a
),
askCount
(
ask
)
{}
std
::
string
iaddr
;
std
::
string
iaddr
;
unsigned
in
t
askCount
;
size_
t
askCount
;
};
};
typedef
std
::
list
<
SessionInfo
>
Sessions
;
typedef
std
::
list
<
SessionInfo
>
Sessions
;
void
getSessions
(
Sessions
&
lst
);
void
getSessions
(
Sessions
&
lst
);
inline
std
::
string
getInetAddress
()
std
::
string
getInetAddress
()
const
;
{
int
getInetPort
()
const
;
return
iaddr
;
}
inline
int
getInetPort
()
{
return
port
;
}
// -------------------------------------------------
// -------------------------------------------------
// Таймер.
// Таймер.
...
@@ -108,10 +90,7 @@ namespace uniset
...
@@ -108,10 +90,7 @@ namespace uniset
TimerSignal
signal_timer
();
TimerSignal
signal_timer
();
void
setTimer
(
timeout_t
msec
);
void
setTimer
(
timeout_t
msec
);
inline
timeout_t
getTimer
()
inline
timeout_t
getTimer
()
const
;
{
return
tmTime
;
}
protected
:
protected
:
...
...
include/modbus/ModbusTCPSession.h
View file @
e77133e0
...
@@ -48,10 +48,7 @@ namespace uniset
...
@@ -48,10 +48,7 @@ namespace uniset
void
connectFinalSession
(
FinalSlot
sl
);
void
connectFinalSession
(
FinalSlot
sl
);
inline
std
::
string
getClientAddress
()
const
std
::
string
getClientAddress
()
const
;
{
return
caddr
;
}
void
setSessionTimeout
(
double
t
);
void
setSessionTimeout
(
double
t
);
...
...
src/Communications/ComPort.cc
View file @
e77133e0
...
@@ -298,6 +298,11 @@ void ComPort::setTimeout( timeout_t msec )
...
@@ -298,6 +298,11 @@ void ComPort::setTimeout( timeout_t msec )
uTimeout
=
msec
*
1000
;
uTimeout
=
msec
*
1000
;
}
}
// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
timeout_t
ComPort
::
getTimeout
()
const
{
return
uTimeout
/
1000
;
// msec
}
// --------------------------------------------------------------------------------
// Lav: ситуация, когда отправлено меньше запрошенного, не типична и должна
// Lav: ситуация, когда отправлено меньше запрошенного, не типична и должна
// генерировать исключение
// генерировать исключение
size_t
ComPort
::
sendBlock
(
unsigned
char
*
msg
,
size_t
len
)
size_t
ComPort
::
sendBlock
(
unsigned
char
*
msg
,
size_t
len
)
...
@@ -391,6 +396,11 @@ void ComPort::setSpeed( const std::string& s )
...
@@ -391,6 +396,11 @@ void ComPort::setSpeed( const std::string& s )
setSpeed
(
sp
);
setSpeed
(
sp
);
}
}
// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
ComPort
::
Speed
ComPort
::
getSpeed
()
const
{
return
speed
;
}
// --------------------------------------------------------------------------------
std
::
string
ComPort
::
getSpeed
(
Speed
s
)
std
::
string
ComPort
::
getSpeed
(
Speed
s
)
{
{
if
(
s
==
ComSpeed9600
)
if
(
s
==
ComSpeed9600
)
...
...
src/Communications/Modbus/ModbusRTUMaster.cc
View file @
e77133e0
...
@@ -81,6 +81,12 @@ namespace uniset
...
@@ -81,6 +81,12 @@ namespace uniset
delete
port
;
delete
port
;
}
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
void
ModbusRTUMaster
::
cleanupChannel
()
{
if
(
port
)
port
->
cleanupChannel
();
}
// -------------------------------------------------------------------------
void
ModbusRTUMaster
::
setSpeed
(
ComPort
::
Speed
s
)
void
ModbusRTUMaster
::
setSpeed
(
ComPort
::
Speed
s
)
{
{
if
(
port
!=
NULL
)
if
(
port
!=
NULL
)
...
@@ -119,7 +125,7 @@ namespace uniset
...
@@ -119,7 +125,7 @@ namespace uniset
port
->
setStopBits
(
sBit
);
port
->
setStopBits
(
sBit
);
}
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
int
ModbusRTUMaster
::
getTimeout
()
timeout_t
ModbusRTUMaster
::
getTimeout
()
const
{
{
if
(
port
==
NULL
)
if
(
port
==
NULL
)
return
0
;
return
0
;
...
...
src/Communications/Modbus/ModbusServer.cc
View file @
e77133e0
...
@@ -63,6 +63,41 @@ namespace uniset
...
@@ -63,6 +63,41 @@ namespace uniset
recvTimeOut_ms
=
msec
;
recvTimeOut_ms
=
msec
;
}
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
void
ModbusServer
::
setSleepPause
(
timeout_t
msec
)
{
sleepPause_msec
=
msec
;
}
// -------------------------------------------------------------------------
void
ModbusServer
::
setCRCNoCheckit
(
bool
set
)
{
crcNoCheckit
=
set
;
}
// -------------------------------------------------------------------------
bool
ModbusServer
::
isCRCNoCheckit
()
const
{
return
crcNoCheckit
;
}
// -------------------------------------------------------------------------
void
ModbusServer
::
setBroadcastMode
(
bool
set
)
{
onBroadcast
=
set
;
}
// -------------------------------------------------------------------------
bool
ModbusServer
::
getBroadcastMode
()
const
{
return
onBroadcast
;
}
// -------------------------------------------------------------------------
void
ModbusServer
::
setCleanBeforeSend
(
bool
set
)
{
cleanBeforeSend
=
set
;
}
// -------------------------------------------------------------------------
bool
ModbusServer
::
getCleanBeforeSend
()
const
{
return
cleanBeforeSend
;
}
// -------------------------------------------------------------------------
timeout_t
ModbusServer
::
setReplyTimeout
(
timeout_t
msec
)
timeout_t
ModbusServer
::
setReplyTimeout
(
timeout_t
msec
)
{
{
// #warning "Why msec can be 0?"
// #warning "Why msec can be 0?"
...
@@ -1675,7 +1710,7 @@ namespace uniset
...
@@ -1675,7 +1710,7 @@ namespace uniset
return
m
;
return
m
;
}
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
size_t
ModbusServer
::
getErrCount
(
mbErrCode
e
)
size_t
ModbusServer
::
getErrCount
(
mbErrCode
e
)
const
{
{
auto
i
=
errmap
.
find
(
e
);
auto
i
=
errmap
.
find
(
e
);
...
@@ -1697,6 +1732,11 @@ namespace uniset
...
@@ -1697,6 +1732,11 @@ namespace uniset
return
ret
;
return
ret
;
}
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
size_t
ModbusServer
::
getAskCount
()
const
{
return
askCount
;
}
// -------------------------------------------------------------------------
void
ModbusServer
::
resetAskCounter
()
void
ModbusServer
::
resetAskCounter
()
{
{
askCount
=
0
;
askCount
=
0
;
...
...
src/Communications/Modbus/ModbusTCPMaster.cc
View file @
e77133e0
...
@@ -333,6 +333,21 @@ namespace uniset
...
@@ -333,6 +333,21 @@ namespace uniset
catch
(
...
)
{}
catch
(
...
)
{}
}
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
void
ModbusTCPMaster
::
cleanupChannel
()
{
cleanInputStream
();
}
// -------------------------------------------------------------------------
string
ModbusTCPMaster
::
getAddress
()
const
{
return
iaddr
;
}
// -------------------------------------------------------------------------
int
ModbusTCPMaster
::
getPort
()
const
{
return
port
;
}
// -------------------------------------------------------------------------
void
ModbusTCPMaster
::
setReadTimeout
(
timeout_t
msec
)
void
ModbusTCPMaster
::
setReadTimeout
(
timeout_t
msec
)
{
{
readTimeout
=
msec
;
readTimeout
=
msec
;
...
@@ -366,6 +381,11 @@ namespace uniset
...
@@ -366,6 +381,11 @@ namespace uniset
return
false
;
return
false
;
}
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
void
ModbusTCPMaster
::
setForceDisconnect
(
bool
s
)
{
force_disconnect
=
s
;
}
// -------------------------------------------------------------------------
bool
ModbusTCPMaster
::
reconnect
()
bool
ModbusTCPMaster
::
reconnect
()
{
{
if
(
dlog
->
is_info
()
)
if
(
dlog
->
is_info
()
)
...
...
src/Communications/Modbus/ModbusTCPServer.cc
View file @
e77133e0
...
@@ -71,16 +71,36 @@ namespace uniset
...
@@ -71,16 +71,36 @@ namespace uniset
maxSessions
=
num
;
maxSessions
=
num
;
}
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
size_t
ModbusTCPServer
::
getCountSessions
()
size_t
ModbusTCPServer
::
getMaxSessions
()
const
{
return
maxSessions
;
}
// -------------------------------------------------------------------------
size_t
ModbusTCPServer
::
getCountSessions
()
const
{
{
return
sessCount
;
return
sessCount
;
}
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
void
ModbusTCPServer
::
setIgnoreAddrMode
(
bool
st
)
{
ignoreAddr
=
st
;
}
// -------------------------------------------------------------------------
bool
ModbusTCPServer
::
getIgnoreAddrMode
()
const
{
return
ignoreAddr
;
}
// -------------------------------------------------------------------------
void
ModbusTCPServer
::
setSessionTimeout
(
timeout_t
msec
)
void
ModbusTCPServer
::
setSessionTimeout
(
timeout_t
msec
)
{
{
sessTimeout
=
msec
;
sessTimeout
=
msec
;
}
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
timeout_t
ModbusTCPServer
::
getSessionTimeout
()
const
{
return
sessTimeout
;
}
// -------------------------------------------------------------------------
bool
ModbusTCPServer
::
run
(
const
std
::
unordered_set
<
ModbusAddr
>&
_vmbaddr
)
bool
ModbusTCPServer
::
run
(
const
std
::
unordered_set
<
ModbusAddr
>&
_vmbaddr
)
{
{
vmbaddr
=
&
_vmbaddr
;
vmbaddr
=
&
_vmbaddr
;
...
@@ -188,6 +208,16 @@ namespace uniset
...
@@ -188,6 +208,16 @@ namespace uniset
}
}
}
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
string
ModbusTCPServer
::
getInetAddress
()
const
{
return
iaddr
;
}
// -------------------------------------------------------------------------
int
ModbusTCPServer
::
getInetPort
()
const
{
return
port
;
}
// -------------------------------------------------------------------------
ModbusTCPServer
::
TimerSignal
ModbusTCPServer
::
signal_timer
()
ModbusTCPServer
::
TimerSignal
ModbusTCPServer
::
signal_timer
()
{
{
return
m_timer_signal
;
return
m_timer_signal
;
...
@@ -213,6 +243,11 @@ namespace uniset
...
@@ -213,6 +243,11 @@ namespace uniset
}
}
}
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
timeout_t
ModbusTCPServer
::
getTimer
()
const
{
return
tmTime
;
}
// -------------------------------------------------------------------------
void
ModbusTCPServer
::
iowait
(
timeout_t
msec
)
void
ModbusTCPServer
::
iowait
(
timeout_t
msec
)
{
{
ptWait
.
setTiming
(
msec
);
ptWait
.
setTiming
(
msec
);
...
...
src/Communications/Modbus/ModbusTCPSession.cc
View file @
e77133e0
...
@@ -591,4 +591,9 @@ namespace uniset
...
@@ -591,4 +591,9 @@ namespace uniset
slFin
=
sl
;
slFin
=
sl
;
}
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
string
ModbusTCPSession
::
getClientAddress
()
const
{
return
caddr
;
}
// -------------------------------------------------------------------------
}
// end of namespace uniset
}
// end of namespace uniset
src/Log/LogReader.cc
View file @
e77133e0
...
@@ -54,6 +54,11 @@ void LogReader::setLogLevel( Debug::type t )
...
@@ -54,6 +54,11 @@ void LogReader::setLogLevel( Debug::type t )
outlog
->
level
(
t
);
outlog
->
level
(
t
);
}
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
std
::
shared_ptr
<
DebugStream
>
LogReader
::
log
()
{
return
outlog
;
}
// -------------------------------------------------------------------------
DebugStream
::
StreamEvent_Signal
LogReader
::
signal_stream_event
()
DebugStream
::
StreamEvent_Signal
LogReader
::
signal_stream_event
()
{
{
return
m_logsig
;
return
m_logsig
;
...
@@ -148,6 +153,36 @@ bool LogReader::isConnection() const
...
@@ -148,6 +153,36 @@ bool LogReader::isConnection() const
return
(
tcp
&&
tcp
->
isConnected
()
);
return
(
tcp
&&
tcp
->
isConnected
()
);
}
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
void
LogReader
::
setReadCount
(
unsigned
int
n
)
{
readcount
=
n
;
}
// -------------------------------------------------------------------------
void
LogReader
::
setCommandOnlyMode
(
bool
s
)
{
cmdonly
=
s
;
}
// -------------------------------------------------------------------------
void
LogReader
::
setinTimeout
(
timeout_t
msec
)
{
inTimeout
=
msec
;
}
// -------------------------------------------------------------------------
void
LogReader
::
setoutTimeout
(
timeout_t
msec
)
{
outTimeout
=
msec
;
}
// -------------------------------------------------------------------------
void
LogReader
::
setReconnectDelay
(
timeout_t
msec
)
{
reconDelay
=
msec
;
}
// -------------------------------------------------------------------------
void
LogReader
::
setTextFilter
(
const
string
&
f
)
{
textfilter
=
f
;
}
// -------------------------------------------------------------------------
void
LogReader
::
sendCommand
(
const
std
::
string
&
_addr
,
int
_port
,
std
::
vector
<
Command
>&
vcmd
,
bool
cmd_only
,
bool
verbose
)
void
LogReader
::
sendCommand
(
const
std
::
string
&
_addr
,
int
_port
,
std
::
vector
<
Command
>&
vcmd
,
bool
cmd_only
,
bool
verbose
)
{
{
if
(
vcmd
.
empty
()
)
if
(
vcmd
.
empty
()
)
...
...
src/Log/LogServer.cc
View file @
e77133e0
...
@@ -41,6 +41,21 @@ namespace uniset
...
@@ -41,6 +41,21 @@ namespace uniset
catch
(...)
{}
catch
(...)
{}
}
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
void
LogServer
::
setCmdTimeout
(
timeout_t
msec
)
noexcept
{
cmdTimeout
=
msec
;
}
// -------------------------------------------------------------------------
void
LogServer
::
setSessionLog
(
Debug
::
type
t
)
noexcept
{
sessLogLevel
=
t
;
}
// -------------------------------------------------------------------------
void
LogServer
::
setMaxSessionCount
(
size_t
num
)
noexcept
{
sessMaxCount
=
num
;
}
// -------------------------------------------------------------------------
LogServer
::
LogServer
(
std
::
shared_ptr
<
LogAgregator
>
log
)
:
LogServer
::
LogServer
(
std
::
shared_ptr
<
LogAgregator
>
log
)
:
LogServer
()
LogServer
()
{
{
...
@@ -111,6 +126,11 @@ namespace uniset
...
@@ -111,6 +126,11 @@ namespace uniset
mylog
.
info
()
<<
myname
<<
"(LogServer): finished."
<<
endl
;
mylog
.
info
()
<<
myname
<<
"(LogServer): finished."
<<
endl
;
}
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
std
::
string
LogServer
::
wname
()
const
noexcept
{
return
myname
;
}
// -------------------------------------------------------------------------
bool
LogServer
::
run
(
const
std
::
string
&
_addr
,
Poco
::
UInt16
_port
)
bool
LogServer
::
run
(
const
std
::
string
&
_addr
,
Poco
::
UInt16
_port
)
{
{
addr
=
_addr
;
addr
=
_addr
;
...
@@ -143,6 +163,11 @@ namespace uniset
...
@@ -143,6 +163,11 @@ namespace uniset
loop
.
evstop
(
this
);
loop
.
evstop
(
this
);
}
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
bool
LogServer
::
isRunning
()
const
noexcept
{
return
isrunning
;
}
// -------------------------------------------------------------------------
bool
LogServer
::
check
(
bool
restart_if_fail
)
bool
LogServer
::
check
(
bool
restart_if_fail
)
{
{
// смущает пока только, что эта функция будет вызыватся (обычно) из другого потока
// смущает пока только, что эта функция будет вызыватся (обычно) из другого потока
...
...
src/Log/LogSession.cc
View file @
e77133e0
...
@@ -636,6 +636,26 @@ namespace uniset
...
@@ -636,6 +636,26 @@ namespace uniset
cancelled
=
true
;
cancelled
=
true
;
}
}
// ---------------------------------------------------------------------
// ---------------------------------------------------------------------
string
LogSession
::
getClientAddress
()
const
noexcept
{
return
caddr
;
}
// ---------------------------------------------------------------------
void
LogSession
::
setSessionLogLevel
(
Debug
::
type
t
)
noexcept
{
mylog
.
level
(
t
);
}
// ---------------------------------------------------------------------
void
LogSession
::
addSessionLogLevel
(
Debug
::
type
t
)
noexcept
{
mylog
.
addLevel
(
t
);
}
// ---------------------------------------------------------------------
void
LogSession
::
delSessionLogLevel
(
Debug
::
type
t
)
noexcept
{
mylog
.
delLevel
(
t
);
}
// ---------------------------------------------------------------------
void
LogSession
::
setMaxBufSize
(
size_t
num
)
void
LogSession
::
setMaxBufSize
(
size_t
num
)
{
{
std
::
unique_lock
<
std
::
mutex
>
lk
(
logbuf_mutex
);
std
::
unique_lock
<
std
::
mutex
>
lk
(
logbuf_mutex
);
...
...
src/ObjectRepository/ObjectIndex.cc
View file @
e77133e0
...
@@ -34,6 +34,16 @@ string ObjectIndex::getNameById( const ObjectId id ) const noexcept
...
@@ -34,6 +34,16 @@ string ObjectIndex::getNameById( const ObjectId id ) const noexcept
return
getMapName
(
id
);
return
getMapName
(
id
);
}
}
// -----------------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------------
std
::
string
ObjectIndex
::
getNodeName
(
const
ObjectId
id
)
const
noexcept
{
return
getNameById
(
id
);
}
// -----------------------------------------------------------------------------------------
ObjectId
ObjectIndex
::
getNodeId
(
const
std
::
__cxx11
::
string
&
name
)
const
noexcept
{
return
getIdByName
(
name
);
}
// -----------------------------------------------------------------------------------------
std
::
string
ObjectIndex
::
getBaseName
(
const
std
::
string
&
fname
)
noexcept
std
::
string
ObjectIndex
::
getBaseName
(
const
std
::
string
&
fname
)
noexcept
{
{
string
::
size_type
pos
=
fname
.
rfind
(
'/'
);
string
::
size_type
pos
=
fname
.
rfind
(
'/'
);
...
...
src/ObjectRepository/ObjectRepository.cc
View file @
e77133e0
...
@@ -308,7 +308,7 @@ throw(ORepFailed, NameNotFound)
...
@@ -308,7 +308,7 @@ throw(ORepFailed, NameNotFound)
* количество объектов в этой секции превышает заданное how_many.
* количество объектов в этой секции превышает заданное how_many.
* \exception ORepFailed - генерируется если произошла при получении доступа к секции
* \exception ORepFailed - генерируется если произошла при получении доступа к секции
*/
*/
bool
ObjectRepository
::
list
(
const
string
&
section
,
ListObjectName
*
ls
,
size_t
how_many
)
throw
(
ORepFailed
)
bool
ObjectRepository
::
list
(
const
string
&
section
,
ListObjectName
*
ls
,
size_t
how_many
)
const
throw
(
ORepFailed
)
{
{
return
list
(
section
,
ls
,
how_many
,
ObjectRef
);
return
list
(
section
,
ls
,
how_many
,
ObjectRef
);
}
}
...
@@ -322,7 +322,7 @@ bool ObjectRepository::list(const string& section, ListObjectName* ls, size_t ho
...
@@ -322,7 +322,7 @@ bool ObjectRepository::list(const string& section, ListObjectName* ls, size_t ho
* количество объектов в этой секции превышает заданное how_many.
* количество объектов в этой секции превышает заданное how_many.
* \exception ORepFailed - генерируется если произошла при получении доступа к секции
* \exception ORepFailed - генерируется если произошла при получении доступа к секции
*/
*/
bool
ObjectRepository
::
listSections
(
const
string
&
in_section
,
ListObjectName
*
ls
,
size_t
how_many
)
throw
(
ORepFailed
)
bool
ObjectRepository
::
listSections
(
const
string
&
in_section
,
ListObjectName
*
ls
,
size_t
how_many
)
const
throw
(
ORepFailed
)
{
{
return
list
(
in_section
,
ls
,
how_many
,
Section
);
return
list
(
in_section
,
ls
,
how_many
,
Section
);
}
}
...
@@ -337,7 +337,7 @@ bool ObjectRepository::listSections(const string& in_section, ListObjectName* ls
...
@@ -337,7 +337,7 @@ bool ObjectRepository::listSections(const string& in_section, ListObjectName* ls
* количество объектов в этой секции превышает заданное how_many.
* количество объектов в этой секции превышает заданное how_many.
* \exception ORepFailed - генерируется если произошла при получении доступа к секции
* \exception ORepFailed - генерируется если произошла при получении доступа к секции
*/
*/
bool
ObjectRepository
::
list
(
const
string
&
section
,
ListObjectName
*
ls
,
unsigned
int
how_many
,
ObjectType
type
)
bool
ObjectRepository
::
list
(
const
string
&
section
,
ListObjectName
*
ls
,
unsigned
int
how_many
,
ObjectType
type
)
const
{
{
// Возвращает false если вынут не весь список...
// Возвращает false если вынут не весь список...
CosNaming
::
NamingContext_var
ctx
;
CosNaming
::
NamingContext_var
ctx
;
...
@@ -563,7 +563,7 @@ bool ObjectRepository::createContext( const string& cname, CosNaming::NamingCont
...
@@ -563,7 +563,7 @@ bool ObjectRepository::createContext( const string& cname, CosNaming::NamingCont
/*!
/*!
\note Функция не вывести список, если не сможет получить доступ к секции
\note Функция не вывести список, если не сможет получить доступ к секции
*/
*/
void
ObjectRepository
::
printSection
(
const
string
&
fullName
)
void
ObjectRepository
::
printSection
(
const
string
&
fullName
)
const
{
{
ListObjectName
ls
;
ListObjectName
ls
;
...
...
src/Processes/IOController.cc
View file @
e77133e0
...
@@ -654,11 +654,6 @@ void IOController::USensorInfo::init( const IOController_i::SensorIOInfo& s )
...
@@ -654,11 +654,6 @@ void IOController::USensorInfo::init( const IOController_i::SensorIOInfo& s )
(
*
this
)
=
std
::
move
(
r
);
(
*
this
)
=
std
::
move
(
r
);
}
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
size_t
IOController
::
ioCount
()
{
return
ioList
.
size
();
}
// ----------------------------------------------------------------------------------------
IOController
::
IOStateList
::
iterator
IOController
::
myioBegin
()
IOController
::
IOStateList
::
iterator
IOController
::
myioBegin
()
{
{
return
ioList
.
begin
();
return
ioList
.
begin
();
...
...
src/Various/Configuration.cc
View file @
e77133e0
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
#include <sstream>
#include <sstream>
#include <iomanip>
#include <iomanip>
#include <string>
#include <string>
#include <cassert>
#include <omniORB4/internal/initRefs.h>
#include <omniORB4/internal/initRefs.h>
#include "Configuration.h"
#include "Configuration.h"
...
@@ -73,8 +74,8 @@ ostream& uniset::Configuration::help(ostream& os)
...
@@ -73,8 +74,8 @@ ostream& uniset::Configuration::help(ostream& os)
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
namespace
uniset
namespace
uniset
{
{
static
shared_ptr
<
Configuration
>
uconf
;
static
s
td
::
s
hared_ptr
<
Configuration
>
uconf
;
static
std
::
shared_ptr
<
DebugStream
>
_ulog
=
nullptr
;
static
std
::
shared_ptr
<
DebugStream
>
_ulog
;
std
::
shared_ptr
<
DebugStream
>
ulog
()
noexcept
std
::
shared_ptr
<
DebugStream
>
ulog
()
noexcept
{
{
...
@@ -88,8 +89,14 @@ namespace uniset
...
@@ -88,8 +89,14 @@ namespace uniset
std
::
shared_ptr
<
Configuration
>
uniset_conf
()
noexcept
std
::
shared_ptr
<
Configuration
>
uniset_conf
()
noexcept
{
{
// if( uconf == nullptr )
// Не делаем assert или exception
// throw SystemError("Don`t init uniset configuration! First use uniset_init().");
// потому-что считаем, что может быть необходимость не вызывать uniset_init()
// Т.е. проверка if( uconf ) возлагается на пользователя.
// assert( uconf );
// if( uconf == nullptr )
// throw SystemError("Don`t init uniset configuration! First use uniset_init().");
return
uconf
;
// см. uniset_init..
return
uconf
;
// см. uniset_init..
}
}
...
...
src/Various/LT_Object.cc
View file @
e77133e0
...
@@ -170,8 +170,8 @@ timeout_t LT_Object::askTimer( uniset::TimerId timerid, timeout_t timeMS, clock_
...
@@ -170,8 +170,8 @@ timeout_t LT_Object::askTimer( uniset::TimerId timerid, timeout_t timeMS, clock_
{
{
if
(
timeMS
<
UniSetTimer
::
MinQuantityTime
)
if
(
timeMS
<
UniSetTimer
::
MinQuantityTime
)
{
{
ucrit
<<
"(LT_askTimer): [мс] попытка заказть таймер "
<<
getTimerName
(
timerid
)
ucrit
<<
"(LT_askTimer): [мс] попытка заказ
а
ть таймер "
<<
getTimerName
(
timerid
)
<<
" со временем срабатыания "
<<
" со временем срабаты
в
ания "
<<
" меньше разрешённого "
<<
UniSetTimer
::
MinQuantityTime
<<
endl
;
<<
" меньше разрешённого "
<<
UniSetTimer
::
MinQuantityTime
<<
endl
;
timeMS
=
UniSetTimer
::
MinQuantityTime
;
timeMS
=
UniSetTimer
::
MinQuantityTime
;
}
}
...
...
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