41 std::uint32_t u32Sequence,
42 std::uint32_t u32Reference)
44 std::vector<std::string> names;
46 for(
int i = 0; i < statistic.names_size(); ++i)
48 names.push_back(statistic.names(i));
55 auto statisticValues =
59 response.set_type(EMANERemoteControlPortAPI::Response::TYPE_RESPONSE_QUERY);
61 auto pQuery = response.mutable_query();
65 auto pStatistic = pQuery->mutable_statistic();
67 pStatistic->set_buildid(statistic.buildid());
69 for(
const auto & entry : statisticValues)
71 auto pElement = pStatistic->add_elements();
73 pElement->set_name(entry.first);
75 auto pValue = pElement->mutable_value();
82 response.set_type(EMANERemoteControlPortAPI::Response::TYPE_RESPONSE_ERROR);
84 auto pError = response.mutable_error();
86 pError->set_type(EMANERemoteControlPortAPI::Response::Error::TYPE_ERROR_PARAMETER);
88 pError->set_description(exp.
what());
91 response.set_reference(u32Reference);
93 response.set_sequence(u32Sequence);
95 std::string sSerialization;
97 if(!response.SerializeToString(&sSerialization))
102 return sSerialization;
static std::string process(const EMANERemoteControlPortAPI::Request::Query::Statistic &statistic, std::uint32_t u32Sequence, std::uint32_t u32Reference)
SerializationException is thrown when an exception occurs during serialization or deserialization of ...
const char * what() const
RegistrarException is thrown when an exception occurs during registration.
void convertToAny(EMANERemoteControlPortAPI::Any *pAny, const EMANE::Any &any)
std::map< std::string, EMANE::Any > queryStatistic(BuildId, const std::vector< std::string > &names) const
static StatisticService * instance()