1#ifndef IV_SRC_CHANNELS_UTILS_HPP_
2#define IV_SRC_CHANNELS_UTILS_HPP_
20 const std::optional<uint8_t> numberOfDecimals = 0,
21 const std::optional<iv::eMeasurementUnit> measurementUnit = std::nullopt)
28 return fmt::format(
"{:.{}f} {}", value, numberOfDecimals.value_or(0),
34 return value == 0 ?
"OP" :
"CL";
68 return fmt::format(
"U{:03}_{:03}", unitId, channelOrder);
73 return fmt::format(
"U{:03}_HB", unitId);
78 return fmt::format(
"{}_HB", stationId);
83 return fmt::format(
"{}_FAIL", stationId);
88 return fmt::format(
"{}_RFAIL", repeaterId);
93 return fmt::format(
"{}_RHB", repeaterId);
98 return fmt::format(
"U{:03}_CANA", unitId);
103 return fmt::format(
"U{:03}_CANB", unitId);
108 return fmt::format(
"U{:03}_CANC", unitId);
113 return fmt::format(
"U{:03}_OFFLINE", unitId);
iv::types::channelOrder networkHeartbeatAndFailureChannelOrder(const iv::types::channelOrder stationOrder, const iv::types::channelOrder commOrder)
Definition utils.hpp:60
std::string generateDefaultStationHeartbeatChannelId(const iv::types::stationId &stationId)
Definition utils.hpp:76
std::string formatValue(const iv::types::channelValue &value, const iv::channels::eChannelBaseType type, const std::optional< uint8_t > numberOfDecimals=0, const std::optional< iv::eMeasurementUnit > measurementUnit=std::nullopt)
Definition utils.hpp:19
std::string generateDefaultStationFailChannelId(const iv::types::stationId &stationId)
Definition utils.hpp:81
bool isSerialLine(const iv::channels::eChannelSpecificType type)
Definition utils.cpp:291
std::string generateDefaultCanBFailChannelId(iv::types::unitId unitId)
Definition utils.hpp:101
std::vector< iv::channels::eAnalogSensorType > sensorTypeByUnitTypeAndChOrder(const iv::units::eUnitType &unitType, const iv::types::channelOrder &chOrder)
Definition utils.cpp:323
std::string generateDefaultLomOfflineChannelId(iv::types::unitId unitId)
Definition utils.hpp:111
std::string generateDefaultChannelId(iv::types::unitId unitId, iv::types::channelOrder channelOrder)
Definition utils.hpp:66
iv::types::Range< uint16_t > watchcallNodeHearbeatAndFailureChannelOrderRange()
Definition utils.hpp:48
std::string generateDefaultCanCFailChannelId(iv::types::unitId unitId)
Definition utils.hpp:106
iv::types::Range< iv::types::channelOrder > unitHeartbeatAndCanFailureChannelOrderRange(const iv::types::unitId unitId)
Definition utils.hpp:54
bool hasToShowRawValue(const iv::channels::eChannelBaseType baseType)
Definition utils.cpp:268
std::string generateDefaultWatchcallNodeHearbeatChannelId(const iv::types::repeaterId &repeaterId)
Definition utils.hpp:91
std::string generateDefaultWatchcallNodeFailChannelId(const iv::types::repeaterId &repeaterId)
Definition utils.hpp:86
std::string generateDefaultLomHeartbeatChannelId(iv::types::unitId unitId)
Definition utils.hpp:71
bool isChannelWithoutAlarm(iv::channels::eChannelSpecificType channelType)
Definition utils.cpp:418
iv::types::Range< uint16_t > stationHeartbeatAndFailureChannelOrderRange()
Definition utils.hpp:43
std::pair< iv::alarms::eAlarmState, iv::alarms::eAlarmType > unpackedStateAlarmAndTypeAlarm(unsigned char stateAndType)
Definition utils.cpp:251
bool isDefaultChannelId(const types::channelId &chId)
Definition utils.cpp:411
void formatTag(iv::types::channelId &id)
Definition utils.hpp:13
iv::types::indexChannel generateIndexChannel(uint16_t id, iv::channels::eChannelSpecificType type)
Definition utils.cpp:123
uint32_t getGlobalId(iv::types::channelOrder channelOrder, iv::types::unitId unitId, iv::channels::eChannelSpecificType channelSpecificType)
Definition utils.cpp:11
std::string generateDefaultCanAFailChannelId(iv::types::unitId unitId)
Definition utils.hpp:96
eChannelSpecificType
Definition enums.hpp:72
eChannelBaseType
Definition enums.hpp:63
static constexpr iv::types::channelOrder commFailureChannelsOffset
Definition defines.hpp:73
void toUpper(StringType &str)
Convert the given text's characters into uppercase ones.
Definition strings.hpp:24
void trim(std::string &str)
Trims left and right whites.
Definition strings.cpp:37
uint32_t indexChannel
Definition types.hpp:87
uint16_t unitId
Definition types.hpp:77
uint16_t channelOrder
Definition types.hpp:68
double channelValue
Definition types.hpp:67
std::string stationId
Definition types.hpp:75
std::string channelId
Definition types.hpp:66
std::string repeaterId
Definition types.hpp:79
eUnitType
Definition enums.hpp:8
static MeasurementUnit get(const iv::eMeasurementUnit &unit)
Definition structs.cpp:102
std::string symbol
Definition structs.hpp:36