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
0863a5f9
Commit
0863a5f9
authored
Dec 12, 2016
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Перенёс испрвления из другой рабочей ветки.
parent
92f74164
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
154 additions
and
88 deletions
+154
-88
ctl-cpp-common.xsl
Utilities/codegen/ctl-cpp-common.xsl
+4
-4
UObject_SK.h
extensions/include/UObject_SK.h
+61
-77
Makefile.am
extensions/lib/Makefile.am
+5
-0
UObject_SK.cc
extensions/lib/UObject_SK.cc
+0
-0
UHttpRequestHandler.h
include/UHttpRequestHandler.h
+1
-1
UInterface_wrap.cxx
python/lib/pyUniSet/UInterface_wrap.cxx
+54
-0
pyUniSet.py
python/lib/pyUniSet/pyUniSet.py
+2
-0
UHttpRequestHandler.cc
src/Communications/Http/UHttpRequestHandler.cc
+7
-2
UHttpServer.cc
src/Communications/Http/UHttpServer.cc
+6
-2
LogServer.cc
src/Log/LogServer.cc
+13
-2
uniset2.files
uniset2.files
+1
-0
No files found.
Utilities/codegen/ctl-cpp-common.xsl
View file @
0863a5f9
...
...
@@ -1259,9 +1259,9 @@ end_private(false)
if( smTestID == DefaultObjectId )
smTestID = getSMTestID();
activateTimeout = conf->getArgPInt("--" + argprefix + "activate-timeout",
4
0000);
activateTimeout = conf->getArgPInt("--" + argprefix + "activate-timeout",
9
0000);
int msec = conf->getArgPInt("--" + argprefix + "startup-timeout",
3
0000);
int msec = conf->getArgPInt("--" + argprefix + "startup-timeout",
5
0000);
ptStartUpTimeout.setTiming(msec);
// =====================
<
variables
>
=====================
...
...
@@ -1730,9 +1730,9 @@ askPause(uniset_conf()->getPIntProp(cnode,"askPause",2000))
vmonit(smReadyTimeout);
vmonit(activateTimeout);
activateTimeout = conf->getArgPInt("--" + argprefix + "activate-timeout",
4
0000);
activateTimeout = conf->getArgPInt("--" + argprefix + "activate-timeout",
9
0000);
int msec = conf->getArgPInt("--" + argprefix + "startup-timeout",
3
0000);
int msec = conf->getArgPInt("--" + argprefix + "startup-timeout",
6
0000);
ptStartUpTimeout.setTiming(msec);
}
...
...
extensions/include/UObject_SK.h
View file @
0863a5f9
...
...
@@ -8,7 +8,7 @@
ВСЕ ВАШИ ИЗМЕНЕНИЯ БУДУТ ПОТЕРЯНЫ.
*/
// --------------------------------------------------------------------------
// generate timestamp: 2016-12-
01
+03:00
// generate timestamp: 2016-12-
12
+03:00
// -----------------------------------------------------------------------------
#ifndef UObject_SK_H_
#define UObject_SK_H_
...
...
@@ -29,7 +29,7 @@ class UObject_SK:
public
uniset
::
UniSetObject
{
public
:
UObject_SK
(
uniset
::
ObjectId
id
,
xmlNode
*
node
=
uniset
::
uniset_conf
()
->
getNode
(
"UObject"
),
const
std
::
string
&
argprefix
=
""
);
UObject_SK
(
uniset
::
ObjectId
id
,
xmlNode
*
node
=
uniset
::
uniset_conf
()
->
getNode
(
"UObject"
),
const
std
::
string
&
argprefix
=
""
);
UObject_SK
();
virtual
~
UObject_SK
();
...
...
@@ -43,60 +43,54 @@ class UObject_SK:
virtual
bool
setMsg
(
uniset
::
ObjectId
code
,
bool
state
=
true
)
noexcept
;
inline
std
::
shared_ptr
<
DebugStream
>
log
()
noexcept
{
return
mylog
;
}
inline
std
::
shared_ptr
<
uniset
::
LogAgregator
>
logAgregator
()
noexcept
{
return
loga
;
}
inline
std
::
shared_ptr
<
DebugStream
>
log
()
noexcept
{
return
mylog
;
}
inline
std
::
shared_ptr
<
uniset
::
LogAgregator
>
logAgregator
()
noexcept
{
return
loga
;
}
void
init_dlog
(
std
::
shared_ptr
<
DebugStream
>
d
)
noexcept
;
// "синтаксический сахар"..для логов
#ifndef myinfo
#define myinfo if( log()->debugging(Debug::INFO) ) log()->info()
#endif
#ifndef mywarn
#define mywarn if( log()->debugging(Debug::WARN) ) log()->warn()
#endif
#ifndef mycrit
#define mycrit if( log()->debugging(Debug::CRIT) ) log()->crit()
#endif
#ifndef mylog1
#define mylog1 if( log()->debugging(Debug::LEVEL1) ) log()->level1()
#endif
#ifndef mylog2
#define mylog2 if( log()->debugging(Debug::LEVEL2) ) log()->level2()
#endif
#ifndef mylog3
#define mylog3 if( log()->debugging(Debug::LEVEL3) ) log()->level3()
#endif
#ifndef mylog4
#define mylog4 if( log()->debugging(Debug::LEVEL4) ) log()->level4()
#endif
#ifndef mylog5
#define mylog5 if( log()->debugging(Debug::LEVEL5) ) log()->level5()
#endif
#ifndef mylog6
#define mylog6 if( log()->debugging(Debug::LEVEL6) ) log()->level6()
#endif
#ifndef mylog7
#define mylog7 if( log()->debugging(Debug::LEVEL7) ) log()->level7()
#endif
#ifndef mylog8
#define mylog8 if( log()->debugging(Debug::LEVEL8) ) log()->level8()
#endif
#ifndef mylog9
#define mylog9 if( log()->debugging(Debug::LEVEL9) ) log()->level9()
#endif
#ifndef mylogany
#define mylogany log()->any()
#endif
#ifndef vmonit
#define vmonit( var ) vmon.add( #var, var )
#endif
#ifndef myinfo
#define myinfo if( log()->debugging(Debug::INFO) ) log()->info()
#endif
#ifndef mywarn
#define mywarn if( log()->debugging(Debug::WARN) ) log()->warn()
#endif
#ifndef mycrit
#define mycrit if( log()->debugging(Debug::CRIT) ) log()->crit()
#endif
#ifndef mylog1
#define mylog1 if( log()->debugging(Debug::LEVEL1) ) log()->level1()
#endif
#ifndef mylog2
#define mylog2 if( log()->debugging(Debug::LEVEL2) ) log()->level2()
#endif
#ifndef mylog3
#define mylog3 if( log()->debugging(Debug::LEVEL3) ) log()->level3()
#endif
#ifndef mylog4
#define mylog4 if( log()->debugging(Debug::LEVEL4) ) log()->level4()
#endif
#ifndef mylog5
#define mylog5 if( log()->debugging(Debug::LEVEL5) ) log()->level5()
#endif
#ifndef mylog6
#define mylog6 if( log()->debugging(Debug::LEVEL6) ) log()->level6()
#endif
#ifndef mylog7
#define mylog7 if( log()->debugging(Debug::LEVEL7) ) log()->level7()
#endif
#ifndef mylog8
#define mylog8 if( log()->debugging(Debug::LEVEL8) ) log()->level8()
#endif
#ifndef mylog9
#define mylog9 if( log()->debugging(Debug::LEVEL9) ) log()->level9()
#endif
#ifndef mylogany
#define mylogany log()->any()
#endif
#ifndef vmonit
#define vmonit( var ) vmon.add( #var, var )
#endif
// Вспомогательные функции для удобства логирования
// ------------------------------------------------------------
...
...
@@ -113,19 +107,16 @@ class UObject_SK:
\param id - идентификатор датчика
\param showLinkName - TRUE - выводить SensorName, FALSE - не выводить
*/
std
::
string
str
(
uniset
::
ObjectId
id
,
bool
showLinkName
=
true
)
const
;
std
::
string
str
(
uniset
::
ObjectId
id
,
bool
showLinkName
=
true
)
const
;
/*! Вывод значения входа/выхода в формате: in_xxx(SensorName)=val
\param id - идентификатор датчика
\param showLinkName - TRUE - выводить SensorName, FALSE - не выводить
*/
std
::
string
strval
(
uniset
::
ObjectId
id
,
bool
showLinkName
=
true
)
const
;
std
::
string
strval
(
uniset
::
ObjectId
id
,
bool
showLinkName
=
true
)
const
;
/*! Вывод состояния внутренних переменных */
inline
std
::
string
dumpVars
()
{
return
std
::
move
(
vmon
.
pretty_str
());
}
inline
std
::
string
dumpVars
(){
return
std
::
move
(
vmon
.
pretty_str
());
}
// ------------------------------------------------------------
std
::
string
help
()
noexcept
;
...
...
@@ -161,25 +152,22 @@ class UObject_SK:
virtual
void
callback
()
noexcept
override
;
virtual
void
processingMessage
(
const
uniset
::
VoidMessage
*
msg
)
override
;
virtual
void
sysCommand
(
const
uniset
::
SystemMessage
*
sm
)
{};
virtual
void
askSensors
(
UniversalIO
::
UIOCommand
cmd
)
{}
virtual
void
sensorInfo
(
const
uniset
::
SensorMessage
*
sm
)
override
{}
virtual
void
timerInfo
(
const
uniset
::
TimerMessage
*
tm
)
override
{}
virtual
void
sysCommand
(
const
uniset
::
SystemMessage
*
sm
){};
virtual
void
askSensors
(
UniversalIO
::
UIOCommand
cmd
){}
virtual
void
sensorInfo
(
const
uniset
::
SensorMessage
*
sm
)
override
{}
virtual
void
timerInfo
(
const
uniset
::
TimerMessage
*
tm
)
override
{}
virtual
void
sigterm
(
int
signo
)
override
;
virtual
bool
activateObject
()
override
;
virtual
std
::
string
getMonitInfo
()
{
return
""
;
/*!< пользовательская информация выводимая в getInfo() */
}
virtual
std
::
string
getMonitInfo
(){
return
""
;
}
/*!< пользовательская информация выводимая в getInfo() */
#ifndef DISABLE_REST_API
virtual
void
httpGetUserData
(
Poco
::
JSON
::
Object
::
Ptr
&
jdata
)
{}
/*!< для пользовательских данных в httpGet() */
virtual
void
httpGetUserData
(
Poco
::
JSON
::
Object
::
Ptr
&
jdata
){}
/*!< для пользовательских данных в httpGet() */
virtual
Poco
::
JSON
::
Object
::
Ptr
httpDumpIO
();
virtual
Poco
::
JSON
::
Object
::
Ptr
httpRequestLog
(
const
Poco
::
URI
::
QueryParameters
&
p
);
#endif
// Выполнение очередного шага программы
virtual
void
step
()
{}
virtual
void
step
(){}
void
preAskSensors
(
UniversalIO
::
UIOCommand
cmd
);
void
preSysCommand
(
const
uniset
::
SystemMessage
*
sm
);
...
...
@@ -208,15 +196,9 @@ class UObject_SK:
xmlNode
*
confnode
;
/*! получить числовое свойство из конф. файла по привязанной confnode */
int
getIntProp
(
const
std
::
string
&
name
)
{
return
uniset
::
uniset_conf
()
->
getIntProp
(
confnode
,
name
);
}
int
getIntProp
(
const
std
::
string
&
name
)
{
return
uniset
::
uniset_conf
()
->
getIntProp
(
confnode
,
name
);
}
/*! получить текстовое свойство из конф. файла по привязанной confnode */
inline
const
std
::
string
getProp
(
const
std
::
string
&
name
)
{
return
uniset
::
uniset_conf
()
->
getProp
(
confnode
,
name
);
}
inline
const
std
::
string
getProp
(
const
std
::
string
&
name
)
{
return
uniset
::
uniset_conf
()
->
getProp
(
confnode
,
name
);
}
uniset
::
timeout_t
smReadyTimeout
;
/*!< время ожидания готовности SM */
std
::
atomic_bool
activated
;
...
...
@@ -267,9 +249,11 @@ class UObject_SK:
}
};
std
::
unordered_map
<
const
uniset
::
ObjectId
,
size_t
,
StatHashFn
>
smStat
;
/*!< количество сообщений по датчикам */
std
::
unordered_map
<
const
uniset
::
ObjectId
,
size_t
,
StatHashFn
>
smStat
;
/*!< количество сообщений по датчикам */
size_t
processingMessageCatchCount
=
{
0
};
/*!< количество исключений пойманных в processingMessage */
std
::
string
ostate
=
{
""
};
/*!< состояние процесса (выводится в getInfo()) */
bool
end_private
;
// вспомогательное поле (для внутреннего использования при генерировании кода)
};
...
...
extensions/lib/Makefile.am
View file @
0863a5f9
...
...
@@ -8,4 +8,9 @@ libUniSet2Extensions_la_LIBADD = $(SIGC_LIBS) $(POCO_LIBS) $(top_builddir)/lib
libUniSet2Extensions_la_SOURCES
=
Extensions.cc SMInterface.cc Calibration.cc SingleProcess.cc
\
IOBase.cc DigitalFilter.cc PID.cc MTR.cc VTypes.cc UObject_SK.cc
UObject_SK.cc
:
$(top_builddir)/Utilities/codegen/*.xsl
$(SHEL)
$(top_builddir)
/Utilities/codegen/uniset2-codegen
-l
$(top_builddir)
/Utilities/codegen
-n
UObject
--no-main
$(top_builddir)
/Utilities/codegen/tests/uobject.src.xml
mv
-f
UObject_SK.h ../include/
include
$(top_builddir)/include.mk
extensions/lib/UObject_SK.cc
View file @
0863a5f9
This diff is collapsed.
Click to expand it.
include/UHttpRequestHandler.h
View file @
0863a5f9
...
...
@@ -75,7 +75,7 @@ namespace uniset
namespace
UHttp
{
// текущая версия API
const
std
::
string
UHTTP_API_VERSION
=
"v0
"
;
const
std
::
string
UHTTP_API_VERSION
=
"v01
"
;
/*! интерфейс для объекта выдающего json-данные */
class
IHttpRequest
...
...
python/lib/pyUniSet/UInterface_wrap.cxx
View file @
0863a5f9
...
...
@@ -4430,6 +4430,58 @@ fail:
}
SWIGINTERN
PyObject
*
_wrap_ShortIOInfo_supplier_node_set
(
PyObject
*
SWIGUNUSEDPARM
(
self
),
PyObject
*
args
)
{
PyObject
*
resultobj
=
0
;
UTypes
::
ShortIOInfo
*
arg1
=
(
UTypes
::
ShortIOInfo
*
)
0
;
long
arg2
;
void
*
argp1
=
0
;
int
res1
=
0
;
long
val2
;
int
ecode2
=
0
;
PyObject
*
obj0
=
0
;
PyObject
*
obj1
=
0
;
if
(
!
PyArg_ParseTuple
(
args
,(
char
*
)
"OO:ShortIOInfo_supplier_node_set"
,
&
obj0
,
&
obj1
))
SWIG_fail
;
res1
=
SWIG_ConvertPtr
(
obj0
,
&
argp1
,
SWIGTYPE_p_UTypes__ShortIOInfo
,
0
|
0
);
if
(
!
SWIG_IsOK
(
res1
))
{
SWIG_exception_fail
(
SWIG_ArgError
(
res1
),
"in method '"
"ShortIOInfo_supplier_node_set"
"', argument "
"1"" of type '"
"UTypes::ShortIOInfo *""'"
);
}
arg1
=
reinterpret_cast
<
UTypes
::
ShortIOInfo
*
>
(
argp1
);
ecode2
=
SWIG_AsVal_long
(
obj1
,
&
val2
);
if
(
!
SWIG_IsOK
(
ecode2
))
{
SWIG_exception_fail
(
SWIG_ArgError
(
ecode2
),
"in method '"
"ShortIOInfo_supplier_node_set"
"', argument "
"2"" of type '"
"long""'"
);
}
arg2
=
static_cast
<
long
>
(
val2
);
if
(
arg1
)
(
arg1
)
->
supplier_node
=
arg2
;
resultobj
=
SWIG_Py_Void
();
return
resultobj
;
fail
:
return
NULL
;
}
SWIGINTERN
PyObject
*
_wrap_ShortIOInfo_supplier_node_get
(
PyObject
*
SWIGUNUSEDPARM
(
self
),
PyObject
*
args
)
{
PyObject
*
resultobj
=
0
;
UTypes
::
ShortIOInfo
*
arg1
=
(
UTypes
::
ShortIOInfo
*
)
0
;
void
*
argp1
=
0
;
int
res1
=
0
;
PyObject
*
obj0
=
0
;
long
result
;
if
(
!
PyArg_ParseTuple
(
args
,(
char
*
)
"O:ShortIOInfo_supplier_node_get"
,
&
obj0
))
SWIG_fail
;
res1
=
SWIG_ConvertPtr
(
obj0
,
&
argp1
,
SWIGTYPE_p_UTypes__ShortIOInfo
,
0
|
0
);
if
(
!
SWIG_IsOK
(
res1
))
{
SWIG_exception_fail
(
SWIG_ArgError
(
res1
),
"in method '"
"ShortIOInfo_supplier_node_get"
"', argument "
"1"" of type '"
"UTypes::ShortIOInfo *""'"
);
}
arg1
=
reinterpret_cast
<
UTypes
::
ShortIOInfo
*
>
(
argp1
);
result
=
(
long
)
((
arg1
)
->
supplier_node
);
resultobj
=
SWIG_From_long
(
static_cast
<
long
>
(
result
));
return
resultobj
;
fail
:
return
NULL
;
}
SWIGINTERN
PyObject
*
_wrap_new_ShortIOInfo
(
PyObject
*
SWIGUNUSEDPARM
(
self
),
PyObject
*
args
)
{
PyObject
*
resultobj
=
0
;
UTypes
::
ShortIOInfo
*
result
=
0
;
...
...
@@ -5403,6 +5455,8 @@ static PyMethodDef SwigMethods[] = {
{
(
char
*
)
"ShortIOInfo_tv_nsec_get"
,
_wrap_ShortIOInfo_tv_nsec_get
,
METH_VARARGS
,
NULL
},
{
(
char
*
)
"ShortIOInfo_supplier_set"
,
_wrap_ShortIOInfo_supplier_set
,
METH_VARARGS
,
NULL
},
{
(
char
*
)
"ShortIOInfo_supplier_get"
,
_wrap_ShortIOInfo_supplier_get
,
METH_VARARGS
,
NULL
},
{
(
char
*
)
"ShortIOInfo_supplier_node_set"
,
_wrap_ShortIOInfo_supplier_node_set
,
METH_VARARGS
,
NULL
},
{
(
char
*
)
"ShortIOInfo_supplier_node_get"
,
_wrap_ShortIOInfo_supplier_node_get
,
METH_VARARGS
,
NULL
},
{
(
char
*
)
"new_ShortIOInfo"
,
_wrap_new_ShortIOInfo
,
METH_VARARGS
,
NULL
},
{
(
char
*
)
"delete_ShortIOInfo"
,
_wrap_delete_ShortIOInfo
,
METH_VARARGS
,
NULL
},
{
(
char
*
)
"ShortIOInfo_swigregister"
,
ShortIOInfo_swigregister
,
METH_VARARGS
,
NULL
},
...
...
python/lib/pyUniSet/pyUniSet.py
View file @
0863a5f9
...
...
@@ -168,6 +168,8 @@ class ShortIOInfo:
__swig_getmethods__
[
"tv_nsec"
]
=
_pyUniSet
.
ShortIOInfo_tv_nsec_get
__swig_setmethods__
[
"supplier"
]
=
_pyUniSet
.
ShortIOInfo_supplier_set
__swig_getmethods__
[
"supplier"
]
=
_pyUniSet
.
ShortIOInfo_supplier_get
__swig_setmethods__
[
"supplier_node"
]
=
_pyUniSet
.
ShortIOInfo_supplier_node_set
__swig_getmethods__
[
"supplier_node"
]
=
_pyUniSet
.
ShortIOInfo_supplier_node_get
def
__init__
(
self
):
this
=
_pyUniSet
.
new_ShortIOInfo
()
...
...
src/Communications/Http/UHttpRequestHandler.cc
View file @
0863a5f9
...
...
@@ -22,8 +22,11 @@
// -------------------------------------------------------------------------
using
namespace
std
;
using
namespace
Poco
::
Net
;
using
namespace
uniset
;
using
namespace
UHttp
;
// -------------------------------------------------------------------------
namespace
uniset
{
using
namespace
UHttp
;
// -------------------------------------------------------------------------
UHttpRequestHandler
::
UHttpRequestHandler
(
std
::
shared_ptr
<
IHttpRequestRegistry
>
_registry
)
:
registry
(
_registry
)
...
...
@@ -166,4 +169,6 @@ Poco::JSON::Object::Ptr IHttpRequest::httpRequest( const string& req, const Poco
throw
uniset
::
SystemError
(
err
.
str
());
}
// -------------------------------------------------------------------------
}
// end of namespace uniset
// -------------------------------------------------------------------------
#endif
src/Communications/Http/UHttpServer.cc
View file @
0863a5f9
...
...
@@ -21,8 +21,10 @@
#include "Exceptions.h"
// -------------------------------------------------------------------------
using
namespace
Poco
::
Net
;
using
namespace
uniset
;
using
namespace
UHttp
;
// -------------------------------------------------------------------------
namespace
uniset
{
using
namespace
UHttp
;
// -------------------------------------------------------------------------
UHttpServer
::
UHttpServer
(
std
::
shared_ptr
<
IHttpRequestRegistry
>&
supplier
,
const
std
::
string
&
_host
,
int
_port
)
:
...
...
@@ -76,4 +78,6 @@ std::shared_ptr<DebugStream> UHttpServer::log()
return
mylog
;
}
// -------------------------------------------------------------------------
}
// end of namespace uniset
// -------------------------------------------------------------------------
#endif // #ifndef DISABLE_REST_API
src/Log/LogServer.cc
View file @
0863a5f9
...
...
@@ -203,7 +203,7 @@ namespace uniset
if
(
mylog
.
is_crit
()
)
mylog
.
crit
()
<<
err
.
str
()
<<
endl
;
throw
SystemError
(
err
.
str
()
);
throw
uniset
::
SystemError
(
err
.
str
()
);
}
try
...
...
@@ -219,7 +219,18 @@ namespace uniset
if
(
mylog
.
is_crit
()
)
mylog
.
crit
()
<<
err
.
str
()
<<
endl
;
throw
SystemError
(
err
.
str
()
);
throw
uniset
::
SystemError
(
err
.
str
()
);
}
catch
(
std
::
exception
&
ex
)
{
ostringstream
err
;
err
<<
myname
<<
"(evprepare): "
<<
ex
.
what
();
if
(
mylog
.
is_crit
()
)
mylog
.
crit
()
<<
err
.
str
()
<<
endl
;
throw
uniset
::
SystemError
(
err
.
str
()
);
}
sock
->
setBlocking
(
false
);
...
...
uniset2.files
View file @
0863a5f9
...
...
@@ -386,6 +386,7 @@ src/Communications/TCP/UTCPStream.cc
src/Communications/TCP/UTCPSocket.cc
src/Communications/TCP/USocket.cc
src/Communications/Http/UHttpRequestHandler.cc
src/Communications/Http/UHttpServer.cc
src/Communications/ComPort.cc
src/Communications/ComPort485F.cc
src/Communications/Makefile.am
...
...
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