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
61c03c90
Commit
61c03c90
authored
Nov 06, 2016
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(codegen):(Http API): добавил команду /log для вывода текущего
уровня включённых логов.
parent
682169f9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
9 deletions
+39
-9
ctl-cpp-common.xsl
Utilities/codegen/ctl-cpp-common.xsl
+38
-6
UniSetObject.cc
src/ObjectRepository/UniSetObject.cc
+1
-3
No files found.
Utilities/codegen/ctl-cpp-common.xsl
View file @
61c03c90
...
...
@@ -256,8 +256,9 @@
// HTTP API
virtual nlohmann::json httpGet( const Poco::URI::QueryParameters
&
p ) override;
virtual nlohmann::json httpDumpIO();
virtual nlohmann::json httpRequest( const std::string
&
req, const Poco::URI::QueryParameters
&
p ) override;
virtual nlohmann::json httpHelp( const Poco::URI::QueryParameters
&
p ) override;
</xsl:template>
<xsl:template
name=
"COMMON-HEAD-PROTECTED"
>
...
...
@@ -271,8 +272,10 @@
virtual bool activateObject() override;
virtual std::string getMonitInfo(){ return ""; } /*!
<
пользовательская информация выводимая в getInfo() */
virtual void httpGetUserData( nlohmann::json
&
jdata ){} /*!
<
для пользовательских данных в httpGet() */
// Выполнение очередного шага программы
virtual nlohmann::json httpDumpIO();
virtual nlohmann::json httpRequestLog( const Poco::URI::QueryParameters
&
p );
// Выполнение очередного шага программы
virtual void step(){}
void preAskSensors( UniversalIO::UIOCommand cmd );
...
...
@@ -564,8 +567,7 @@ nlohmann::json <xsl:value-of select="$CLASSNAME"/>_SK::httpGet( const Poco::URI:
<xsl:if
test=
"not(normalize-space($BASECLASS)='')"
>
nlohmann::json json =
<xsl:value-of
select=
"$BASECLASS"
/>
::httpGet(params);
</xsl:if>
<xsl:if
test=
"normalize-space($BASECLASS)=''"
>
nlohmann::json json = UniSetObject::httpGet(params);
</xsl:if>
std::string myid(to_string(getId()));
auto
&
jdata = json[myid];
auto
&
jdata = json[myname];
if( logserv )
{
...
...
@@ -620,6 +622,36 @@ nlohmann::json <xsl:value-of select="$CLASSNAME"/>_SK::httpGet( const Poco::URI:
return std::move(json);
}
// -----------------------------------------------------------------------------
nlohmann::json
<xsl:value-of
select=
"$CLASSNAME"
/>
_SK::httpHelp( const Poco::URI::QueryParameters
&
params )
{
<xsl:if
test=
"not(normalize-space($BASECLASS)='')"
>
nlohmann::json jdata =
<xsl:value-of
select=
"$BASECLASS"
/>
::httpHelp(params);
</xsl:if>
<xsl:if
test=
"normalize-space($BASECLASS)=''"
>
nlohmann::json jdata = UniSetObject::httpGet(params);
</xsl:if>
auto
&
jhelp = jdata[myname]["help"];
jhelp["log"]["desc"] = "show log level";
return jdata;
}
// -----------------------------------------------------------------------------
nlohmann::json
<xsl:value-of
select=
"$CLASSNAME"
/>
_SK::httpRequest( const std::string
&
req, const Poco::URI::QueryParameters
&
p )
{
if( req == "log" )
return httpRequestLog(p);
<xsl:if
test=
"not(normalize-space($BASECLASS)='')"
>
return
<xsl:value-of
select=
"$BASECLASS"
/>
::httpRequest(req,p);
</xsl:if>
<xsl:if
test=
"normalize-space($BASECLASS)=''"
>
return UniSetObject::httpRequest(req,p);
</xsl:if>
}
// -----------------------------------------------------------------------------
nlohmann::json
<xsl:value-of
select=
"$CLASSNAME"
/>
_SK::httpRequestLog( const Poco::URI::QueryParameters
&
p )
{
nlohmann::json jret;
auto
&
jdata = jret[myname];
jdata["log"] = Debug::str(mylog->level());
return std::move(jret);
}
// -----------------------------------------------------------------------------
<xsl:if
test=
"normalize-space($TESTMODE)!=''"
>
bool
<xsl:value-of
select=
"$CLASSNAME"
/>
_SK::checkTestMode() const noexcept
{
...
...
src/ObjectRepository/UniSetObject.cc
View file @
61c03c90
...
...
@@ -382,9 +382,7 @@ void UniSetObject::push( const TransportMessage& tm )
nlohmann
::
json
UniSetObject
::
httpGet
(
const
Poco
::
URI
::
QueryParameters
&
p
)
{
nlohmann
::
json
jret
;
std
::
string
myid
(
to_string
(
getId
()));
auto
&
jdata
=
jret
[
myid
];
auto
&
jdata
=
jret
[
myname
];
jdata
[
"name"
]
=
myname
;
jdata
[
"id"
]
=
getId
();
...
...
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