Commit 16208bca authored by George Nash's avatar George Nash

Fixed the get calls for binaryswitch and brightness

Change-Id: Ia4efc35b9e497e7feb57c969642b46ed131f80d1
Signed-off-by: George Nash's avatarGeorge Nash <george.nash@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/18619Tested-by: default avatarjenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: Larry Sachs's avatarLarry Sachs <larry.j.sachs@intel.com>
parent 44646ac1
......@@ -112,15 +112,16 @@ void MenuBinarySwitch::run(const std::vector<std::string> &cmd,
if (eCode == OC_STACK_OK)
{
bool powerState;
std::string uri;
rep.getValue("uri", uri);
if (uri == bswitch.getResource()->uri())
std::cout << rep.getUri() << std::endl;
if (rep.getUri() == bswitch.getResource()->uri())
{
rep.getValue("value", powerState);
std::cout << "\t" << ((powerState) ? "is ON" : "is OFF") << std::endl;
}
else
{
std::cout << "\t" << "is UNKNOWN" << std::endl;
}
std::cout << uri << std::endl;
std::cout << "\t" << ((powerState) ? "is ON" : "is OFF") << std::endl;
//bswitch.turnOnAsync(!powerState, [](const OC::HeaderOptions &headerOptions, const OC::OCRepresentation &rep, const int eCode){});
}
});
......@@ -138,15 +139,16 @@ void MenuBinarySwitch::run(const std::vector<std::string> &cmd,
if (eCode == OC_STACK_OK)
{
bool powerState;
std::string uri;
rep.getValue("uri", uri);
if (uri == b.getResource()->uri())
std::cout << rep.getUri() << std::endl;
if (rep.getUri() == b.getResource()->uri())
{
rep.getValue("value", powerState);
std::cout << "\t" << ((powerState) ? "is ON" : "is OFF") << std::endl;
}
else
{
std::cout << "\t" << "is UNKNOWN" << std::endl;
}
std::cout << uri << std::endl;
std::cout << "\t" << ((powerState) ? "is ON" : "is OFF") << std::endl;
//bswitch.turnOnAsync(!powerState, [](const OC::HeaderOptions &headerOptions, const OC::OCRepresentation &rep, const int eCode){});
}
});
}
......@@ -245,9 +247,7 @@ void MenuBinarySwitch::run(const std::vector<std::string> &cmd,
if (eCode == OC_STACK_OK)
{
bool powerState;
std::string uri;
rep.getValue("uri", uri);
if (uri == bswitch.getResource()->uri())
if (rep.getUri() == bswitch.getResource()->uri())
{
rep.getValue("value", powerState);
}
......@@ -272,9 +272,7 @@ void MenuBinarySwitch::run(const std::vector<std::string> &cmd,
if (eCode == OC_STACK_OK)
{
bool powerState;
std::string uri;
rep.getValue("uri", uri);
if (uri == b.getResource()->uri())
if (rep.getUri() == b.getResource()->uri())
{
rep.getValue("value", powerState);
}
......
......@@ -111,14 +111,17 @@ void MenuBrightness::run(const std::vector<std::string> &cmd,
if (eCode == OC_STACK_OK)
{
int brightness;
std::string uri;
rep.getValue("uri", uri);
if (uri == b.getResource()->uri())
std::cout << rep.getUri() << std::endl;
if (rep.getUri() == b.getResource()->uri())
{
rep.getValue("brightness", brightness);
std::cout << "\t" << brightness << "%" << std::endl;
}
std::cout << uri << std::endl;
std::cout << "\t" << brightness << "%" << std::endl;
else
{
std::cout << "\tUNKNOWN" << std::endl;
}
}
});
......@@ -136,14 +139,16 @@ void MenuBrightness::run(const std::vector<std::string> &cmd,
if (eCode == OC_STACK_OK)
{
int brightness;
std::string uri;
rep.getValue("uri", uri);
if (uri == b.getResource()->uri())
std::cout << rep.getUri() << std::endl;
if (rep.getUri() == b.getResource()->uri())
{
rep.getValue("brightness", brightness);
std::cout << "\t" << brightness << "%" << std::endl;
}
else
{
std::cout << "\tUNKNOWN" << std::endl;
}
std::cout << uri << std::endl;
std::cout << "\t" << brightness << "%" << std::endl;
}
});
}
......
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