IINField LoggingHandler::PrintOctets(const ICollection<Indexed<OctetString>>& items) { Indent i(*callbacks); auto logItem = [this](const Indexed<OctetString>& item) { auto slice = item.value.ToRSlice(); FORMAT_LOG_BLOCK(logger, flags::APP_OBJECT_RX, "[%u] value: (length = %u)", item.index, slice.Size()); FORMAT_HEX_BLOCK(logger, flags::APP_OBJECT_RX, slice, 18, 18); }; items.ForeachItem(logItem); return IINField::Empty(); }
IINField LoggingHandler::ProcessHeader(const CountHeader& header, const ICollection<Group120Var4>& values) { Indent i(*callbacks); auto print = [this](const Group120Var4 & value) { std::ostringstream oss; oss << "user: " << value.userNum; SIMPLE_LOG_BLOCK(logger, flags::APP_OBJECT_RX, oss.str().c_str()); }; values.ForeachItem(print); return IINField::Empty(); }
IINField LoggingHandler::PrintTimeAndInterval(const ICollection<Indexed<TimeAndInterval>>& values) { Indent i(*callbacks); auto logItem = [this](const Indexed<TimeAndInterval>& item) { std::ostringstream oss; oss << "[" << item.index << "] - startTime: " << ToUTCString(item.value.time); oss << " count: " << item.value.interval; oss << " units: " << IntervalUnitsToString(item.value.GetUnitsEnum()) << " (" << static_cast<int>(item.value.units) << ")"; SIMPLE_LOG_BLOCK(logger, flags::APP_OBJECT_RX, oss.str().c_str()); }; values.ForeachItem(logItem); return IINField::Empty(); }
IINField LoggingHandler::ProcessHeader(const PrefixHeader& header, const ICollection<Indexed<Group122Var2>>& values) { Indent i(*callbacks); auto logItem = [this](const Indexed<Group122Var2>& item) { std::ostringstream oss; oss << "[" << item.index << "] - flags: 0x" << ToHex(item.value.flags); oss << " assoc: " << item.value.assocId; oss << " value: " << item.value.value; oss << " time: " << ToUTCString(item.value.time); SIMPLE_LOG_BLOCK(logger, flags::APP_OBJECT_RX, oss.str().c_str()); }; values.ForeachItem(logItem); return IINField::Empty(); }
IINField LoggingHandler::PrintCrob(const ICollection<Indexed<ControlRelayOutputBlock>>& items) { Indent i(*callbacks); auto logItem = [this](const Indexed<ControlRelayOutputBlock>& item) { std::ostringstream oss; oss << "[" << item.index << "] - code: 0x" << ToHex(item.value.rawCode) << " (" << ControlCodeToString(item.value.functionCode) << ")"; oss << " count: " << static_cast<uint32_t>(item.value.count); oss << " on-time: " << static_cast<uint32_t>(item.value.onTimeMS); oss << " off-time: " << static_cast<uint32_t>(item.value.offTimeMS); oss << " status: " << CommandStatusToString(item.value.status); SIMPLE_LOG_BLOCK(logger, flags::APP_OBJECT_RX, oss.str().c_str()); }; items.ForeachItem(logItem); return IINField::Empty(); }
IINField LoggingHandler::ProcessHeader(const PrefixHeader& header, const ICollection<Indexed<AnalogCommandEvent>>& values) { Indent i(*callbacks); const bool HAS_TIME = HasAbsoluteTime(header.enumeration); auto logItem = [this, HAS_TIME](const Indexed<AnalogCommandEvent>& item) { std::ostringstream oss; oss << "[" << item.index << "] - value: " << item.value.value << " status: " << CommandStatusToString(item.value.status); if (HAS_TIME) { oss << " time: " << ToUTCString(item.value.time); } SIMPLE_LOG_BLOCK(logger, flags::APP_OBJECT_RX, oss.str().c_str()); }; values.ForeachItem(logItem); return IINField::Empty(); }