ParamServer logic improvement

This commit is contained in:
Pavel Kirienko
2015-03-23 18:14:44 +03:00
parent a12dc5aa98
commit 6598b15d88
2 changed files with 8 additions and 0 deletions
@@ -33,6 +33,12 @@ void ParamServer::handleGetSet(const protocol::param::GetSet::Request& in, proto
out.name = in.name;
}
if (out.name.empty())
{
UAVCAN_TRACE("ParamServer", "GetSet: Can't resolve parameter name, index=%i", int(in.index));
return;
}
// Assign if needed, read back
if (isValueNonEmpty(in.value))
{
+2
View File
@@ -27,6 +27,7 @@ struct ParamServerTestManager : public uavcan::IParamManager
virtual void assignParamValue(const ParamName& name, const ParamValue& value)
{
assert(!name.empty());
std::cout << "ASSIGN [" << name.c_str() << "]\n" << value << "\n---" << std::endl;
KeyValue::iterator it = kv.find(name.c_str());
if (it != kv.end())
@@ -56,6 +57,7 @@ struct ParamServerTestManager : public uavcan::IParamManager
virtual void readParamValue(const ParamName& name, ParamValue& out_value) const
{
assert(!name.empty());
KeyValue::const_iterator it = kv.find(name.c_str());
if (it != kv.end())
{