Commit 50b4f892 authored by Pavel Vainerman's avatar Pavel Vainerman

(HTTP): немного переделал создание help

parent 10b40d03
......@@ -693,7 +693,7 @@ Poco::JSON::Object::Ptr <xsl:value-of select="$CLASSNAME"/>_SK::httpHelp( const
<xsl:if test="normalize-space($BASECLASS)=''">uniset::json::help::object myhelp(myname, UniSetObject::httpGet(params));</xsl:if>
// 'log'
uniset::json::help::item cmd("show log level");
uniset::json::help::item cmd("log","show log level");
myhelp.add(cmd);
return myhelp;
......
......@@ -2016,7 +2016,7 @@ namespace uniset
{
// 'regs'
uniset::json::help::item cmd("get registers list");
uniset::json::help::item cmd("regs", "get registers list");
cmd.param("regs=reg1,reg2,reg3..", "get these registers");
cmd.param("addr=mbaddr1,mbaddr2,..", "get registers for mbaddr");
myhelp.add(cmd);
......
......@@ -628,7 +628,7 @@ Poco::JSON::Object::Ptr UObject_SK::httpHelp( const Poco::URI::QueryParameters&
uniset::json::help::object myhelp(myname, UniSetObject::httpGet(params));
// 'log'
uniset::json::help::item cmd("show log level");
uniset::json::help::item cmd("log","show log level");
myhelp.add(cmd);
return myhelp;
......
......@@ -37,7 +37,7 @@ namespace uniset
public:
item( Poco::JSON::Object::Ptr& ptr );
item( const std::string& description );
item( const std::string& cmd, const std::string& description );
void param(const std::string& name, const std::string& description );
Poco::JSON::Object::Ptr get();
......
......@@ -850,7 +850,7 @@ Poco::JSON::Object::Ptr IOController::httpHelp( const Poco::URI::QueryParameters
{
// 'get'
uniset::json::help::item cmd("get value for sensor");
uniset::json::help::item cmd("get","get value for sensor");
cmd.param("id1,name2,id3", "get value for id1,name2,id3 sensors");
cmd.param("shortInfo", "get short information for sensors");
myhelp.add(cmd);
......@@ -858,7 +858,7 @@ Poco::JSON::Object::Ptr IOController::httpHelp( const Poco::URI::QueryParameters
{
// 'sensors'
uniset::json::help::item cmd("get all sensors");
uniset::json::help::item cmd("sensors", "get all sensors");
cmd.param("nameonly", "get only name sensors");
cmd.param("offset=N", "get from N record");
cmd.param("limit=M", "limit of records");
......
......@@ -41,10 +41,10 @@ namespace uniset
params = ptr->getArray("parameters");
}
// --------------------------------------------------------------------------
json::help::item::item(const std::string& description)
json::help::item::item( const std::string& cmd, const std::string& description )
{
root = new Poco::JSON::Object();
root->set("description", description);
root->set(cmd, description);
}
// --------------------------------------------------------------------------
void json::help::item::param(const std::string& name, const std::string& description)
......
......@@ -30,13 +30,13 @@ class UTestSupplier:
{
uniset::json::help::object myhelp("test");
uniset::json::help::item cmd1("description for cmd1");
uniset::json::help::item cmd1("cmd1", "description for cmd1");
cmd1.param("p1", "description of p1");
cmd1.param("p2", "description of p1");
cmd1.param("p3", "description of p1");
myhelp.add(cmd1);
uniset::json::help::item cmd2("description for cmd2");
uniset::json::help::item cmd2("cmd2", "description for cmd2");
cmd2.param("p1", "description of p1");
cmd2.param("p2", "description of p1");
cmd2.param("p3", "description of p1");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment