mirror of
https://github.com/thelsing/knx.git
synced 2024-12-18 19:08:18 +01:00
reduce use of std::string
This commit is contained in:
parent
8f3e2f683f
commit
e0f0b49db4
@ -90,7 +90,7 @@ bool AddressTableObject::contains(uint16_t addr)
|
||||
|
||||
void AddressTableObject::beforeStateChange(LoadState& newState)
|
||||
{
|
||||
LOGGER.info("beforeStateChange %S", enum_name(newState));
|
||||
LOGGER.info("beforeStateChange %s", enum_name(newState));
|
||||
TableObject::beforeStateChange(newState);
|
||||
|
||||
if (newState != LS_LOADED)
|
||||
|
@ -43,7 +43,7 @@ uint8_t APDU::length() const
|
||||
string APDU::toString() const
|
||||
{
|
||||
#ifndef KNX_NO_PRINT
|
||||
string value = "APDU: " + enum_name(type()) + " ";
|
||||
string value = std::string("APDU: ") + enum_name(type()) + " ";
|
||||
value += byte2hex(_data[0] & 0x3);
|
||||
|
||||
for (uint8_t i = 1; i < length() + 1; ++i)
|
||||
|
@ -39,7 +39,7 @@ void ApplicationLayer::dataGroupIndication(HopCountType hopType, Priority priori
|
||||
|
||||
void ApplicationLayer::dataGroupIndication(HopCountType hopType, Priority priority, uint16_t tsap, APDU& apdu, const SecurityControl& secCtrl)
|
||||
{
|
||||
LOGGER.info("dataGroupIndication %S", apdu.toString());
|
||||
LOGGER.info("dataGroupIndication %s", apdu.toString().c_str());
|
||||
|
||||
if (_assocTable == nullptr)
|
||||
return;
|
||||
@ -92,7 +92,7 @@ void ApplicationLayer::dataGroupConfirm(AckType ack, HopCountType hopType, Prior
|
||||
|
||||
void ApplicationLayer::dataGroupConfirm(AckType ack, HopCountType hopType, Priority priority, uint16_t tsap, APDU& apdu, const SecurityControl& secCtrl, bool status)
|
||||
{
|
||||
LOGGER.info("dataGroupConfirm %S", apdu.toString());
|
||||
LOGGER.info("dataGroupConfirm %s", apdu.toString().c_str());
|
||||
|
||||
switch (apdu.type())
|
||||
{
|
||||
@ -130,7 +130,7 @@ void ApplicationLayer::dataBroadcastIndication(HopCountType hopType, Priority pr
|
||||
|
||||
void ApplicationLayer::dataBroadcastIndication(HopCountType hopType, Priority priority, uint16_t source, APDU& apdu, const SecurityControl& secCtrl)
|
||||
{
|
||||
LOGGER.info("dataBroadcastIndication %S", apdu.toString());
|
||||
LOGGER.info("dataBroadcastIndication %s", apdu.toString().c_str());
|
||||
uint8_t* data = apdu.data();
|
||||
|
||||
switch (apdu.type())
|
||||
@ -190,7 +190,7 @@ void ApplicationLayer::dataBroadcastConfirm(AckType ack, HopCountType hopType, P
|
||||
|
||||
void ApplicationLayer::dataBroadcastConfirm(AckType ack, HopCountType hopType, Priority priority, APDU& apdu, const SecurityControl& secCtrl, bool status)
|
||||
{
|
||||
LOGGER.info("dataBroadcastConfirm %S", apdu.toString());
|
||||
LOGGER.info("dataBroadcastConfirm %s", apdu.toString().c_str());
|
||||
uint8_t* data = apdu.data();
|
||||
|
||||
switch (apdu.type())
|
||||
@ -245,7 +245,7 @@ void ApplicationLayer::dataSystemBroadcastIndication(HopCountType hopType, Prior
|
||||
|
||||
void ApplicationLayer::dataSystemBroadcastIndication(HopCountType hopType, Priority priority, uint16_t source, APDU& apdu, const SecurityControl& secCtrl)
|
||||
{
|
||||
LOGGER.info("dataSystemBroadcastIndication %S", apdu.toString());
|
||||
LOGGER.info("dataSystemBroadcastIndication %s", apdu.toString().c_str());
|
||||
const uint8_t* data = apdu.data();
|
||||
|
||||
switch (apdu.type())
|
||||
@ -294,7 +294,7 @@ void ApplicationLayer::dataSystemBroadcastConfirm(HopCountType hopType, Priority
|
||||
|
||||
void ApplicationLayer::dataSystemBroadcastConfirm(HopCountType hopType, Priority priority, APDU& apdu, const SecurityControl& secCtrl, bool status)
|
||||
{
|
||||
LOGGER.info("dataSystemBroadcastConfirm %S", apdu.toString());
|
||||
LOGGER.info("dataSystemBroadcastConfirm %s", apdu.toString().c_str());
|
||||
const uint8_t* data = apdu.data();
|
||||
|
||||
switch (apdu.type())
|
||||
@ -1118,7 +1118,7 @@ void ApplicationLayer::userMemorySend(ApduType type, AckType ack, Priority prior
|
||||
|
||||
void ApplicationLayer::individualIndication(HopCountType hopType, Priority priority, uint16_t tsap, APDU& apdu, const SecurityControl& secCtrl)
|
||||
{
|
||||
LOGGER.info("individualIndication %S", apdu.toString());
|
||||
LOGGER.info("individualIndication %s", apdu.toString().c_str());
|
||||
uint8_t* data = apdu.data();
|
||||
|
||||
switch (apdu.type())
|
||||
@ -1374,13 +1374,13 @@ void ApplicationLayer::individualIndication(HopCountType hopType, Priority prior
|
||||
}
|
||||
|
||||
default:
|
||||
LOGGER.warning("Individual-indication: unhandled APDU-Type: %S", apdu.toString());
|
||||
LOGGER.warning("Individual-indication: unhandled APDU-Type: %s", apdu.toString().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void ApplicationLayer::individualConfirm(AckType ack, HopCountType hopType, Priority priority, uint16_t tsap, APDU& apdu, const SecurityControl& secCtrl, bool status)
|
||||
{
|
||||
LOGGER.info("individualConfirm %S", apdu.toString());
|
||||
LOGGER.info("individualConfirm %s", apdu.toString().c_str());
|
||||
uint8_t* data = apdu.data();
|
||||
|
||||
switch (apdu.type())
|
||||
|
@ -103,6 +103,6 @@ double ApplicationProgramObject::getFloat(uint32_t addr, ParameterFloatEncodings
|
||||
|
||||
void ApplicationProgramObject::beforeStateChange(LoadState& newState)
|
||||
{
|
||||
LOGGER.info("beforeStateChange %S", enum_name(newState));
|
||||
LOGGER.info("beforeStateChange %s", enum_name(newState));
|
||||
TableObject::beforeStateChange(newState);
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ int32_t AssociationTableObject::translateAsap(uint16_t asap)
|
||||
|
||||
void AssociationTableObject::beforeStateChange(LoadState& newState)
|
||||
{
|
||||
LOGGER.info("beforeStateChange %S", enum_name(newState));
|
||||
LOGGER.info("beforeStateChange %s", enum_name(newState));
|
||||
TableObject::beforeStateChange(newState);
|
||||
|
||||
if (newState != LS_LOADED)
|
||||
|
@ -403,13 +403,19 @@ bool CemiFrame::valid() const
|
||||
std::string CemiFrame::toString() const
|
||||
{
|
||||
#ifndef KNX_NO_PRINT
|
||||
std::string value = "DPDU:" + enum_name(frameType()) + " ";
|
||||
value += enum_name(systemBroadcast()) + " ";
|
||||
value += enum_name(ack()) + " ";
|
||||
value += enum_name(repetition()) + " ";
|
||||
value += enum_name(priority()) + " from ";
|
||||
value += format_ia(sourceAddress()) + " to ";
|
||||
value += enum_name(addressType()) + " ";
|
||||
std::string value = std::string("DPDU:") + enum_name(frameType()) + " ";
|
||||
value += enum_name(systemBroadcast());
|
||||
value += " ";
|
||||
value += enum_name(ack());
|
||||
value += " ";
|
||||
value += enum_name(repetition());
|
||||
value += " ";
|
||||
value += enum_name(priority());
|
||||
value += " from ";
|
||||
value += format_ia(sourceAddress());
|
||||
value += " to ";
|
||||
value += enum_name(addressType());
|
||||
value += " ";
|
||||
|
||||
if (addressType() == AddressType::IndividualAddress)
|
||||
value += format_ia(destinationAddress());
|
||||
|
@ -59,7 +59,7 @@ bool DataLinkLayer::isTunnelAddress(uint16_t addr)
|
||||
}
|
||||
#endif
|
||||
|
||||
void DataLinkLayer::dataRequestFromTunnel(CemiFrame& frame)
|
||||
void DataLinkLayer::cddataRequestFromTunnel(CemiFrame& frame)
|
||||
{
|
||||
_cemiServer->dataConfirmationToTunnel(frame);
|
||||
|
||||
@ -161,7 +161,7 @@ void DataLinkLayer::frameReceived(CemiFrame& frame)
|
||||
SystemBroadcast systemBroadcast = frame.systemBroadcast();
|
||||
|
||||
|
||||
LOGGER.info("frameReceived %S", frame.toString());
|
||||
LOGGER.info("frameReceived %s", frame.toString().c_str());
|
||||
|
||||
|
||||
#ifdef USE_CEMI_SERVER
|
||||
@ -222,7 +222,7 @@ bool DataLinkLayer::sendTelegram(NPDU& npdu, AckType ack, uint16_t destinationAd
|
||||
else
|
||||
frame.frameType(format);
|
||||
|
||||
LOGGER.info("sendTelegram %S", frame.toString());
|
||||
LOGGER.info("sendTelegram %s", frame.toString().c_str());
|
||||
|
||||
if (!frame.valid())
|
||||
{
|
||||
|
@ -33,11 +33,11 @@ class DataLinkLayer
|
||||
Platform& platform);
|
||||
#ifdef USE_CEMI_SERVER
|
||||
void cemiServer(CemiServer& cemiServer);
|
||||
#endif
|
||||
|
||||
#ifdef KNX_TUNNELING
|
||||
// from tunnel
|
||||
void dataRequestFromTunnel(CemiFrame& frame);
|
||||
#endif
|
||||
#ifdef KNX_TUNNELING
|
||||
virtual void dataRequestToTunnel(CemiFrame& frame);
|
||||
virtual void dataConfirmationToTunnel(CemiFrame& frame);
|
||||
virtual void dataIndicationToTunnel(CemiFrame& frame);
|
||||
|
@ -80,7 +80,7 @@ void GroupObjectTableObject::groupObjects(GroupObject* objs, uint16_t size)
|
||||
|
||||
void GroupObjectTableObject::beforeStateChange(LoadState& newState)
|
||||
{
|
||||
LOGGER.info("beforeStateChange %S", enum_name(newState));
|
||||
LOGGER.info("beforeStateChange %s", enum_name(newState));
|
||||
TableObject::beforeStateChange(newState);
|
||||
|
||||
if (newState != LS_LOADED)
|
||||
|
@ -330,7 +330,7 @@ void IpDataLinkLayer::loop()
|
||||
uint16_t code;
|
||||
popWord(code, buffer + 2);
|
||||
|
||||
LOGGER.info("loop: %s", enum_name((KnxIpServiceType)code).c_str());
|
||||
LOGGER.info("loop: %s", enum_name((KnxIpServiceType)code));
|
||||
|
||||
switch ((KnxIpServiceType)code)
|
||||
{
|
||||
@ -1138,7 +1138,7 @@ bool IpDataLinkLayer::sendMulicast(KnxIpFrame& ipFrame)
|
||||
if (!_enabled)
|
||||
return false;
|
||||
|
||||
LOGGER.info("sendMulicast %S", ipFrame.toString());
|
||||
LOGGER.info("sendMulicast %s %s", enum_name(ipFrame.protocolVersion()), enum_name(ipFrame.serviceTypeIdentifier()));
|
||||
|
||||
return _platform.sendBytesMultiCast(ipFrame.data(), ipFrame.totalLength());
|
||||
}
|
||||
@ -1148,7 +1148,7 @@ bool IpDataLinkLayer::sendUnicast(uint32_t addr, uint16_t port, KnxIpFrame& ipFr
|
||||
if (!_enabled)
|
||||
return false;
|
||||
|
||||
LOGGER.info("sendUnicast to %S:%d %S", ipaddr2str(addr), port, ipFrame.toString());
|
||||
LOGGER.info("sendUnicast to %s:%d %s %s", ipaddr2str(addr), port, enum_name(ipFrame.protocolVersion()), enum_name(ipFrame.serviceTypeIdentifier()));
|
||||
|
||||
return _platform.sendBytesMultiCast(ipFrame.data(), ipFrame.totalLength());
|
||||
}
|
||||
|
@ -77,12 +77,7 @@ KnxIpFrame::KnxIpFrame(uint16_t length)
|
||||
totalLength(length);
|
||||
}
|
||||
|
||||
const std::string KnxIpFrame::toString() const
|
||||
{
|
||||
return enum_name(protocolVersion()) + " " + enum_name(serviceTypeIdentifier());
|
||||
}
|
||||
|
||||
const string enum_name(const KnxIpVersion enum_val)
|
||||
const char* enum_name(const KnxIpVersion enum_val)
|
||||
{
|
||||
switch (enum_val)
|
||||
{
|
||||
@ -90,10 +85,10 @@ const string enum_name(const KnxIpVersion enum_val)
|
||||
return "KnxIp1_0";
|
||||
}
|
||||
|
||||
return to_string(enum_val);
|
||||
return "";
|
||||
}
|
||||
|
||||
const string enum_name(const KnxIpServiceType enum_val)
|
||||
const char* enum_name(const KnxIpServiceType enum_val)
|
||||
{
|
||||
switch (enum_val)
|
||||
{
|
||||
@ -152,5 +147,5 @@ const string enum_name(const KnxIpServiceType enum_val)
|
||||
return "RoutingLostMessage";
|
||||
}
|
||||
|
||||
return to_string(enum_val);
|
||||
return "";
|
||||
}
|
@ -8,7 +8,7 @@ enum KnxIpVersion
|
||||
{
|
||||
KnxIp1_0 = 0x10
|
||||
};
|
||||
const string enum_name(const KnxIpVersion enum_val);
|
||||
const char* enum_name(const KnxIpVersion enum_val);
|
||||
|
||||
enum KnxIpServiceType
|
||||
{
|
||||
@ -31,7 +31,7 @@ enum KnxIpServiceType
|
||||
RoutingIndication = 0x530,
|
||||
RoutingLostMessage = 0x531,
|
||||
};
|
||||
const string enum_name(const KnxIpServiceType enum_val);
|
||||
const char* enum_name(const KnxIpServiceType enum_val);
|
||||
|
||||
class KnxIpFrame
|
||||
{
|
||||
@ -48,7 +48,6 @@ class KnxIpFrame
|
||||
uint16_t totalLength() const;
|
||||
void totalLength(uint16_t length);
|
||||
uint8_t* data();
|
||||
const std::string toString() const;
|
||||
protected:
|
||||
bool _freeData = false;
|
||||
uint8_t* _data = 0;
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "knx_types.h"
|
||||
#ifndef KNX_NO_PRINT
|
||||
const string enum_name(const LCCONFIG enum_val)
|
||||
const char* enum_name(const LCCONFIG enum_val)
|
||||
{
|
||||
switch (enum_val)
|
||||
{
|
||||
@ -35,11 +35,11 @@ const string enum_name(const LCCONFIG enum_val)
|
||||
return "PHYS_IACK_ALL";
|
||||
}
|
||||
|
||||
return to_string(enum_val);
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
const string enum_name(const LCGRPCONFIG enum_val)
|
||||
const char* enum_name(const LCGRPCONFIG enum_val)
|
||||
{
|
||||
switch (enum_val)
|
||||
{
|
||||
@ -65,11 +65,11 @@ const string enum_name(const LCGRPCONFIG enum_val)
|
||||
return "GROUP_7000LOCK";
|
||||
}
|
||||
|
||||
return to_string(enum_val);
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
const string enum_name(const DptMedium enum_val)
|
||||
const char* enum_name(const DptMedium enum_val)
|
||||
{
|
||||
switch (enum_val)
|
||||
{
|
||||
@ -86,11 +86,11 @@ const string enum_name(const DptMedium enum_val)
|
||||
return "KNX_IP";
|
||||
}
|
||||
|
||||
return to_string(enum_val);
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
const string enum_name(const EraseCode enum_val)
|
||||
const char* enum_name(const EraseCode enum_val)
|
||||
{
|
||||
switch (enum_val)
|
||||
{
|
||||
@ -119,11 +119,11 @@ const string enum_name(const EraseCode enum_val)
|
||||
return "FactoryResetWithoutIA";
|
||||
}
|
||||
|
||||
return to_string(enum_val);
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
const string enum_name(const RestartType enum_val)
|
||||
const char* enum_name(const RestartType enum_val)
|
||||
{
|
||||
switch (enum_val)
|
||||
{
|
||||
@ -134,11 +134,11 @@ const string enum_name(const RestartType enum_val)
|
||||
return "MasterReset";
|
||||
}
|
||||
|
||||
return to_string(enum_val);
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
const string enum_name(const DataSecurity enum_val)
|
||||
const char* enum_name(const DataSecurity enum_val)
|
||||
{
|
||||
switch (enum_val)
|
||||
{
|
||||
@ -152,11 +152,11 @@ const string enum_name(const DataSecurity enum_val)
|
||||
return "AuthConf";
|
||||
}
|
||||
|
||||
return to_string(enum_val);
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
const string enum_name(const ApduType enum_val)
|
||||
const char* enum_name(const ApduType enum_val)
|
||||
{
|
||||
switch (enum_val)
|
||||
{
|
||||
@ -359,11 +359,11 @@ const string enum_name(const ApduType enum_val)
|
||||
return "SecureService";
|
||||
}
|
||||
|
||||
return to_string(enum_val);
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
const string enum_name(const TpduType enum_val)
|
||||
const char* enum_name(const TpduType enum_val)
|
||||
{
|
||||
switch (enum_val)
|
||||
{
|
||||
@ -392,11 +392,11 @@ const string enum_name(const TpduType enum_val)
|
||||
return "Nack";
|
||||
}
|
||||
|
||||
return to_string(enum_val);
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
const string enum_name(const HopCountType enum_val)
|
||||
const char* enum_name(const HopCountType enum_val)
|
||||
{
|
||||
switch (enum_val)
|
||||
{
|
||||
@ -407,11 +407,11 @@ const string enum_name(const HopCountType enum_val)
|
||||
return "NetworkLayerParameter";
|
||||
}
|
||||
|
||||
return to_string(enum_val);
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
const string enum_name(const Confirm enum_val)
|
||||
const char* enum_name(const Confirm enum_val)
|
||||
{
|
||||
switch (enum_val)
|
||||
{
|
||||
@ -422,11 +422,11 @@ const string enum_name(const Confirm enum_val)
|
||||
return "ConfirmError";
|
||||
}
|
||||
|
||||
return to_string(enum_val);
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
const string enum_name(const SystemBroadcast enum_val)
|
||||
const char* enum_name(const SystemBroadcast enum_val)
|
||||
{
|
||||
switch (enum_val)
|
||||
{
|
||||
@ -437,11 +437,11 @@ const string enum_name(const SystemBroadcast enum_val)
|
||||
return "Broadcast";
|
||||
}
|
||||
|
||||
return to_string(enum_val);
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
const string enum_name(Repetition enum_val)
|
||||
const char* enum_name(Repetition enum_val)
|
||||
{
|
||||
switch (enum_val)
|
||||
{
|
||||
@ -452,10 +452,10 @@ const string enum_name(Repetition enum_val)
|
||||
return "WasNotRepeated/RepetitionAllowed";
|
||||
}
|
||||
|
||||
return to_string(enum_val);
|
||||
return "";
|
||||
}
|
||||
|
||||
const string enum_name(const ReturnCodes enum_val)
|
||||
const char* enum_name(const ReturnCodes enum_val)
|
||||
{
|
||||
switch (enum_val)
|
||||
{
|
||||
@ -511,11 +511,11 @@ const string enum_name(const ReturnCodes enum_val)
|
||||
return "GenericError";
|
||||
}
|
||||
|
||||
return to_string(enum_val);
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
const string enum_name(const cEmiErrorCode enum_val)
|
||||
const char* enum_name(const cEmiErrorCode enum_val)
|
||||
{
|
||||
switch (enum_val)
|
||||
{
|
||||
@ -553,11 +553,11 @@ const string enum_name(const cEmiErrorCode enum_val)
|
||||
return "Value_temp_not_writeable";
|
||||
}
|
||||
|
||||
return to_string(enum_val);
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
const string enum_name(const MessageCode enum_val)
|
||||
const char* enum_name(const MessageCode enum_val)
|
||||
{
|
||||
switch (enum_val)
|
||||
{
|
||||
@ -601,11 +601,11 @@ const string enum_name(const MessageCode enum_val)
|
||||
return "M_Reset_ind";
|
||||
}
|
||||
|
||||
return to_string(enum_val);
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
const string enum_name(const AddressType enum_val)
|
||||
const char* enum_name(const AddressType enum_val)
|
||||
{
|
||||
switch (enum_val)
|
||||
{
|
||||
@ -616,11 +616,11 @@ const string enum_name(const AddressType enum_val)
|
||||
return "GroupAddress";
|
||||
}
|
||||
|
||||
return to_string(enum_val);
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
const string enum_name(const TPAckType enum_val)
|
||||
const char* enum_name(const TPAckType enum_val)
|
||||
{
|
||||
switch (enum_val)
|
||||
{
|
||||
@ -637,11 +637,11 @@ const string enum_name(const TPAckType enum_val)
|
||||
return "AckReqNone";
|
||||
}
|
||||
|
||||
return to_string(enum_val);
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
const string enum_name(const AckType enum_val)
|
||||
const char* enum_name(const AckType enum_val)
|
||||
{
|
||||
switch (enum_val)
|
||||
{
|
||||
@ -652,11 +652,11 @@ const string enum_name(const AckType enum_val)
|
||||
return "AckRequested";
|
||||
}
|
||||
|
||||
return to_string(enum_val);
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
const string enum_name(const Priority enum_val)
|
||||
const char* enum_name(const Priority enum_val)
|
||||
{
|
||||
switch (enum_val)
|
||||
{
|
||||
@ -673,11 +673,11 @@ const string enum_name(const Priority enum_val)
|
||||
return "SystemPriority";
|
||||
}
|
||||
|
||||
return to_string(enum_val);
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
const string enum_name(const FrameFormat enum_val)
|
||||
const char* enum_name(const FrameFormat enum_val)
|
||||
{
|
||||
switch (enum_val)
|
||||
{
|
||||
@ -688,7 +688,7 @@ const string enum_name(const FrameFormat enum_val)
|
||||
return "StandardFrame";
|
||||
}
|
||||
|
||||
return to_string(enum_val);
|
||||
return "";
|
||||
}
|
||||
|
||||
const string format_ia(uint16_t ia)
|
||||
|
@ -8,7 +8,7 @@ enum FrameFormat
|
||||
ExtendedFrame = 0,
|
||||
StandardFrame = 0x80
|
||||
};
|
||||
const string enum_name(const FrameFormat enum_val);
|
||||
const char* enum_name(const FrameFormat enum_val);
|
||||
|
||||
enum Priority
|
||||
{
|
||||
@ -17,14 +17,14 @@ enum Priority
|
||||
UrgentPriority = 0x8, //!< Used for alarms.
|
||||
SystemPriority = 0x0 //!< Mainly used by ETS for device programming.
|
||||
};
|
||||
const string enum_name(const Priority enum_val);
|
||||
const char* enum_name(const Priority enum_val);
|
||||
|
||||
enum AckType
|
||||
{
|
||||
AckDontCare = 0, //!< We don't care about DataLinkLayer acknowledgement.
|
||||
AckRequested = 0x2, //!< We want a DataLinkLayer acknowledgement.
|
||||
};
|
||||
const string enum_name(const AckType enum_val);
|
||||
const char* enum_name(const AckType enum_val);
|
||||
|
||||
enum TPAckType
|
||||
{
|
||||
@ -34,14 +34,14 @@ enum TPAckType
|
||||
AckReqAck = 0x01,
|
||||
AckReqNone = 0x0,
|
||||
};
|
||||
const string enum_name(const TPAckType enum_val);
|
||||
const char* enum_name(const TPAckType enum_val);
|
||||
|
||||
enum AddressType
|
||||
{
|
||||
IndividualAddress = 0,
|
||||
GroupAddress = 0x80,
|
||||
};
|
||||
const string enum_name(const AddressType enum_val);
|
||||
const char* enum_name(const AddressType enum_val);
|
||||
|
||||
enum MessageCode
|
||||
{
|
||||
@ -67,7 +67,7 @@ enum MessageCode
|
||||
M_Reset_req = 0xF1,
|
||||
M_Reset_ind = 0xF0,
|
||||
};
|
||||
const string enum_name(const MessageCode enum_val);
|
||||
const char* enum_name(const MessageCode enum_val);
|
||||
|
||||
enum cEmiErrorCode
|
||||
{
|
||||
@ -83,7 +83,7 @@ enum cEmiErrorCode
|
||||
Prop_Index_Range_Error = 0x09, // read or write access to a non existing Property array index (R/W)
|
||||
Value_temp_not_writeable = 0x0A, // The Property exists but can at this moment not be written with a new value (W)
|
||||
};
|
||||
const string enum_name(const cEmiErrorCode enum_val);
|
||||
const char* enum_name(const cEmiErrorCode enum_val);
|
||||
|
||||
// Unified return codes for KNX services and functions
|
||||
// Note, that several older KNX services and functions do not use these return codes.
|
||||
@ -109,7 +109,7 @@ enum ReturnCodes
|
||||
DataTypeConflict = 0xFE, // write access with wrong datatype (datapoint length)
|
||||
GenericError = 0xFF // service, function or command failed
|
||||
};
|
||||
const string enum_name(const ReturnCodes enum_val);
|
||||
const char* enum_name(const ReturnCodes enum_val);
|
||||
|
||||
enum Repetition
|
||||
{
|
||||
@ -118,28 +118,28 @@ enum Repetition
|
||||
RepetitionAllowed = 0x20,
|
||||
WasNotRepeated = 0x20,
|
||||
};
|
||||
const string enum_name(Repetition enum_val);
|
||||
const char* enum_name(Repetition enum_val);
|
||||
|
||||
enum SystemBroadcast
|
||||
{
|
||||
SysBroadcast = 0,
|
||||
Broadcast = 0x10,
|
||||
};
|
||||
const string enum_name(const SystemBroadcast enum_val);
|
||||
const char* enum_name(const SystemBroadcast enum_val);
|
||||
|
||||
enum Confirm
|
||||
{
|
||||
ConfirmNoError = 0,
|
||||
ConfirmError = 1,
|
||||
};
|
||||
const string enum_name(const Confirm enum_val);
|
||||
const char* enum_name(const Confirm enum_val);
|
||||
|
||||
enum HopCountType
|
||||
{
|
||||
UnlimitedRouting, //!< NPDU::hopCount is set to 7. This means that the frame never expires. This could be a problem if your bus contains a circle.
|
||||
NetworkLayerParameter //!< use NetworkLayer::hopCount as NPDU::hopCount
|
||||
};
|
||||
const string enum_name(const HopCountType enum_val);
|
||||
const char* enum_name(const HopCountType enum_val);
|
||||
|
||||
enum TpduType
|
||||
{
|
||||
@ -152,7 +152,7 @@ enum TpduType
|
||||
Ack,
|
||||
Nack,
|
||||
};
|
||||
const string enum_name(const TpduType enum_val);
|
||||
const char* enum_name(const TpduType enum_val);
|
||||
|
||||
enum ApduType
|
||||
{
|
||||
@ -234,7 +234,7 @@ enum ApduType
|
||||
// Secure Service
|
||||
SecureService = 0x3F1
|
||||
};
|
||||
const string enum_name(const ApduType enum_val);
|
||||
const char* enum_name(const ApduType enum_val);
|
||||
|
||||
enum DataSecurity
|
||||
{
|
||||
@ -242,7 +242,7 @@ enum DataSecurity
|
||||
Auth,
|
||||
AuthConf
|
||||
};
|
||||
const string enum_name(const DataSecurity enum_val);
|
||||
const char* enum_name(const DataSecurity enum_val);
|
||||
|
||||
struct SecurityControl
|
||||
{
|
||||
@ -255,7 +255,7 @@ enum RestartType
|
||||
BasicRestart = 0x0,
|
||||
MasterReset = 0x1
|
||||
};
|
||||
const string enum_name(const RestartType enum_val);
|
||||
const char* enum_name(const RestartType enum_val);
|
||||
|
||||
enum EraseCode
|
||||
{
|
||||
@ -268,7 +268,7 @@ enum EraseCode
|
||||
ResetLinks = 0x06,
|
||||
FactoryResetWithoutIA = 0x07
|
||||
};
|
||||
const string enum_name(const EraseCode enum_val);
|
||||
const char* enum_name(const EraseCode enum_val);
|
||||
|
||||
enum DptMedium
|
||||
{
|
||||
@ -279,7 +279,7 @@ enum DptMedium
|
||||
KNX_RF = 0x02,
|
||||
KNX_IP = 0x05
|
||||
};
|
||||
const string enum_name(const DptMedium enum_val);
|
||||
const char* enum_name(const DptMedium enum_val);
|
||||
|
||||
enum LCGRPCONFIG
|
||||
{
|
||||
@ -293,7 +293,7 @@ enum LCGRPCONFIG
|
||||
GROUP_7000LOCK = 0b00001000,
|
||||
GROUP_7000ROUTE = 0b00001100
|
||||
};
|
||||
const string enum_name(const LCGRPCONFIG enum_val);
|
||||
const char* enum_name(const LCGRPCONFIG enum_val);
|
||||
|
||||
enum LCCONFIG
|
||||
{
|
||||
@ -310,7 +310,7 @@ enum LCCONFIG
|
||||
PHYS_IACK_ALL = 0b10000000,
|
||||
PHYS_IACK_NACK = 0b11000000
|
||||
};
|
||||
const string enum_name(const LCCONFIG enum_val);
|
||||
const char* enum_name(const LCCONFIG enum_val);
|
||||
|
||||
const string format_ia(uint16_t ia);
|
||||
const string format_ga(uint16_t ga);
|
@ -27,7 +27,7 @@ void Memory::readMemory()
|
||||
return;
|
||||
}
|
||||
|
||||
LOGGER.info("content %S", array2hex(flashStart, _metadataSize));
|
||||
LOGGER.info("content %s", array2hex(flashStart, _metadataSize).c_str());
|
||||
|
||||
uint16_t metadataBlockSize = alignToPageSize(_metadataSize);
|
||||
|
||||
@ -70,9 +70,9 @@ void Memory::readMemory()
|
||||
else
|
||||
{
|
||||
LOGGER.warning("manufacturerId or hardwareType are different");
|
||||
LOGGER.warning("expexted manufacturerId: %S , stored manufacturerId: %S",
|
||||
LOGGER.warning("expexted manufacturerId: %s , stored manufacturerId: %s",
|
||||
word2hex(_deviceObject.manufacturerId()), manufacturerId);
|
||||
LOGGER.warning("expexted hardwareType: %S, stored hardwareType: %S",
|
||||
LOGGER.warning("expexted hardwareType: %s, stored hardwareType: %s",
|
||||
array2hex(_deviceObject.hardwareType(), LEN_HARDWARE_TYPE),
|
||||
array2hex(hardwareType, LEN_HARDWARE_TYPE));
|
||||
}
|
||||
@ -80,7 +80,7 @@ void Memory::readMemory()
|
||||
else
|
||||
{
|
||||
LOGGER.warning("DataObject api changed, any data stored in flash is invalid.");
|
||||
LOGGER.warning("expexted DataObject api version: %S, stored api version: %S", word2hex(_deviceObject.apiVersion), word2hex(apiVersion));
|
||||
LOGGER.warning("expexted DataObject api version: %s, stored api version: %s", word2hex(_deviceObject.apiVersion), word2hex(apiVersion));
|
||||
}
|
||||
|
||||
if (versionCheck == FlashAllInvalid)
|
||||
|
@ -32,7 +32,7 @@ void NetworkLayerDevice::dataIndividualRequest(AckType ack, uint16_t destination
|
||||
// print.print("-> NL ");
|
||||
// tpdu.apdu().printPDU();
|
||||
//}
|
||||
LOGGER.info("dataIndividualRequest %S", npdu.toString());
|
||||
LOGGER.info("dataIndividualRequest %s", npdu.toString().c_str());
|
||||
_netLayerEntities[kInterfaceIndex].sendDataRequest(npdu, ack, destination, _deviceObj.individualAddress(), priority, IndividualAddress, Broadcast);
|
||||
}
|
||||
|
||||
@ -45,7 +45,7 @@ void NetworkLayerDevice::dataGroupRequest(AckType ack, uint16_t destination, Hop
|
||||
else
|
||||
npdu.hopCount(hopCount());
|
||||
|
||||
LOGGER.info("dataGroupRequest %S", npdu.toString());
|
||||
LOGGER.info("dataGroupRequest %s", npdu.toString().c_str());
|
||||
_netLayerEntities[kInterfaceIndex].sendDataRequest(npdu, ack, destination, _deviceObj.individualAddress(), priority, GroupAddress, Broadcast);
|
||||
}
|
||||
|
||||
@ -58,7 +58,7 @@ void NetworkLayerDevice::dataBroadcastRequest(AckType ack, HopCountType hopType,
|
||||
else
|
||||
npdu.hopCount(hopCount());
|
||||
|
||||
LOGGER.info("dataBroadcastRequest %S", npdu.toString());
|
||||
LOGGER.info("dataBroadcastRequest %s", npdu.toString().c_str());
|
||||
_netLayerEntities[kInterfaceIndex].sendDataRequest(npdu, ack, 0, _deviceObj.individualAddress(), priority, GroupAddress, Broadcast);
|
||||
}
|
||||
|
||||
@ -75,13 +75,13 @@ void NetworkLayerDevice::dataSystemBroadcastRequest(AckType ack, HopCountType ho
|
||||
else
|
||||
npdu.hopCount(hopCount());
|
||||
|
||||
LOGGER.info("dataSystemBroadcastRequest %S", npdu.toString());
|
||||
LOGGER.info("dataSystemBroadcastRequest %s", npdu.toString().c_str());
|
||||
_netLayerEntities[kInterfaceIndex].sendDataRequest(npdu, ack, 0, _deviceObj.individualAddress(), priority, GroupAddress, broadcastType);
|
||||
}
|
||||
|
||||
void NetworkLayerDevice::dataIndication(AckType ack, AddressType addrType, uint16_t destination, FrameFormat format, NPDU& npdu, Priority priority, uint16_t source, uint8_t srcIfIdx)
|
||||
{
|
||||
LOGGER.info("dataIndication %S", npdu.toString());
|
||||
LOGGER.info("dataIndication %s", npdu.toString().c_str());
|
||||
HopCountType hopType = npdu.hopCount() == 7 ? UnlimitedRouting : NetworkLayerParameter;
|
||||
|
||||
if (addrType == IndividualAddress)
|
||||
@ -103,7 +103,7 @@ void NetworkLayerDevice::dataIndication(AckType ack, AddressType addrType, uint1
|
||||
|
||||
void NetworkLayerDevice::dataConfirm(AckType ack, AddressType addressType, uint16_t destination, FrameFormat format, Priority priority, uint16_t source, NPDU& npdu, bool status, uint8_t srcIfIdx)
|
||||
{
|
||||
LOGGER.info("dataConfirm %S", npdu.toString());
|
||||
LOGGER.info("dataConfirm %s", npdu.toString().c_str());
|
||||
HopCountType hopType = npdu.hopCount() == 7 ? UnlimitedRouting : NetworkLayerParameter;
|
||||
|
||||
if (addressType == IndividualAddress)
|
||||
@ -122,7 +122,7 @@ void NetworkLayerDevice::dataConfirm(AckType ack, AddressType addressType, uint1
|
||||
|
||||
void NetworkLayerDevice::broadcastIndication(AckType ack, FrameFormat format, NPDU& npdu, Priority priority, uint16_t source, uint8_t srcIfIdx)
|
||||
{
|
||||
LOGGER.info("broadcastIndication %S", npdu.toString());
|
||||
LOGGER.info("broadcastIndication %s", npdu.toString().c_str());
|
||||
HopCountType hopType = npdu.hopCount() == 7 ? UnlimitedRouting : NetworkLayerParameter;
|
||||
DptMedium mediumType = _netLayerEntities[srcIfIdx].mediumType();
|
||||
|
||||
@ -143,21 +143,21 @@ void NetworkLayerDevice::broadcastIndication(AckType ack, FrameFormat format, NP
|
||||
|
||||
void NetworkLayerDevice::broadcastConfirm(AckType ack, FrameFormat format, Priority priority, uint16_t source, NPDU& npdu, bool status, uint8_t srcIfIdx)
|
||||
{
|
||||
LOGGER.info("broadcastConfirm %S", npdu.toString());
|
||||
LOGGER.info("broadcastConfirm %s", npdu.toString().c_str());
|
||||
HopCountType hopType = npdu.hopCount() == 7 ? UnlimitedRouting : NetworkLayerParameter;
|
||||
_transportLayer.dataBroadcastConfirm(ack, hopType, priority, npdu.tpdu(), status);
|
||||
}
|
||||
|
||||
void NetworkLayerDevice::systemBroadcastIndication(AckType ack, FrameFormat format, NPDU& npdu, Priority priority, uint16_t source, uint8_t srcIfIdx)
|
||||
{
|
||||
LOGGER.info("systemBroadcastIndication %S", npdu.toString());
|
||||
LOGGER.info("systemBroadcastIndication %s", npdu.toString().c_str());
|
||||
HopCountType hopType = npdu.hopCount() == 7 ? UnlimitedRouting : NetworkLayerParameter;
|
||||
_transportLayer.dataSystemBroadcastIndication(hopType, priority, source, npdu.tpdu());
|
||||
}
|
||||
|
||||
void NetworkLayerDevice::systemBroadcastConfirm(AckType ack, FrameFormat format, Priority priority, uint16_t source, NPDU& npdu, bool status, uint8_t srcIfIdx)
|
||||
{
|
||||
LOGGER.info("systemBroadcastConfirm %S", npdu.toString());
|
||||
LOGGER.info("systemBroadcastConfirm %s", npdu.toString().c_str());
|
||||
HopCountType hopType = npdu.hopCount() == 7 ? UnlimitedRouting : NetworkLayerParameter;
|
||||
_transportLayer.dataSystemBroadcastConfirm(ack, hopType, npdu.tpdu(), priority, status);
|
||||
}
|
||||
|
@ -245,7 +245,7 @@ void Property::state(uint8_t* data, uint8_t length, uint8_t* resultData, uint8_t
|
||||
resultLength = 0;
|
||||
}
|
||||
#ifndef KNX_NO_PRINT
|
||||
const string enum_name(const PropertyDataType enum_val)
|
||||
const char* enum_name(const PropertyDataType enum_val)
|
||||
{
|
||||
switch (enum_val)
|
||||
{
|
||||
@ -397,10 +397,10 @@ const string enum_name(const PropertyDataType enum_val)
|
||||
return "PDT_ESCAPE";
|
||||
}
|
||||
|
||||
return to_string(enum_val);
|
||||
return "";
|
||||
}
|
||||
|
||||
const string enum_name(const PropertyID enum_val)
|
||||
const char* enum_name(const PropertyID enum_val)
|
||||
{
|
||||
switch (enum_val)
|
||||
{
|
||||
@ -718,10 +718,10 @@ const string enum_name(const PropertyID enum_val)
|
||||
return "PID_IP_ENABLE_SBC";
|
||||
}
|
||||
|
||||
return to_string(enum_val);
|
||||
return "";
|
||||
}
|
||||
|
||||
const string enum_name(const LoadState enum_val)
|
||||
const char* enum_name(const LoadState enum_val)
|
||||
{
|
||||
switch (enum_val)
|
||||
{
|
||||
@ -744,10 +744,10 @@ const string enum_name(const LoadState enum_val)
|
||||
return "LS_LOADCOMPLETING";
|
||||
}
|
||||
|
||||
return to_string(enum_val);
|
||||
return "";
|
||||
}
|
||||
|
||||
const string enum_name(const LoadEvents enum_val)
|
||||
const char* enum_name(const LoadEvents enum_val)
|
||||
{
|
||||
switch (enum_val)
|
||||
{
|
||||
@ -767,10 +767,10 @@ const string enum_name(const LoadEvents enum_val)
|
||||
return "LE_UNLOAD";
|
||||
}
|
||||
|
||||
return to_string(enum_val);
|
||||
return "";
|
||||
}
|
||||
|
||||
const string enum_name(const ErrorCode enum_val)
|
||||
const char* enum_name(const ErrorCode enum_val)
|
||||
{
|
||||
switch (enum_val)
|
||||
{
|
||||
@ -832,10 +832,10 @@ const string enum_name(const ErrorCode enum_val)
|
||||
return "E_GO_TYPE_TOO_BIG";
|
||||
}
|
||||
|
||||
return to_string(enum_val);
|
||||
return "";
|
||||
}
|
||||
|
||||
const string enum_name(const AccessLevel enum_val)
|
||||
const char* enum_name(const AccessLevel enum_val)
|
||||
{
|
||||
switch (enum_val)
|
||||
{
|
||||
@ -861,6 +861,6 @@ const string enum_name(const AccessLevel enum_val)
|
||||
return "WriteLv3";
|
||||
}
|
||||
|
||||
return to_string(enum_val);
|
||||
return "";
|
||||
}
|
||||
#endif
|
@ -66,7 +66,7 @@ enum PropertyDataType
|
||||
PDT_FUNCTION = 0x3e, //!< length: 3
|
||||
PDT_ESCAPE = 0x3f, //!< length: 3
|
||||
};
|
||||
const std::string enum_name(const PropertyDataType enum_val);
|
||||
const char* enum_name(const PropertyDataType enum_val);
|
||||
|
||||
enum PropertyID
|
||||
{
|
||||
@ -195,7 +195,7 @@ enum PropertyID
|
||||
PID_RF_ENABLE_SBC = 112, // Exists only if medium for this router object is RF (PDT_FUNCTION)
|
||||
PID_IP_ENABLE_SBC = 120, // Exists only if medium for this router object is IP (PDT_FUNCTION)
|
||||
};
|
||||
const std::string enum_name(const PropertyID enum_val);
|
||||
const char* enum_name(const PropertyID enum_val);
|
||||
|
||||
enum LoadState
|
||||
{
|
||||
@ -206,7 +206,7 @@ enum LoadState
|
||||
LS_UNLOADING = 4,
|
||||
LS_LOADCOMPLETING = 5
|
||||
};
|
||||
const std::string enum_name(const LoadState enum_val);
|
||||
const char* enum_name(const LoadState enum_val);
|
||||
|
||||
enum LoadEvents
|
||||
{
|
||||
@ -216,7 +216,7 @@ enum LoadEvents
|
||||
LE_ADDITIONAL_LOAD_CONTROLS = 3,
|
||||
LE_UNLOAD = 4
|
||||
};
|
||||
const std::string enum_name(const LoadEvents enum_val);
|
||||
const char* enum_name(const LoadEvents enum_val);
|
||||
|
||||
// 20.011 DPT_ErrorClass_System
|
||||
enum ErrorCode
|
||||
@ -241,7 +241,7 @@ enum ErrorCode
|
||||
E_INVALID_GO_NUMBER = 17,
|
||||
E_GO_TYPE_TOO_BIG = 18
|
||||
};
|
||||
const std::string enum_name(const ErrorCode enum_val);
|
||||
const char* enum_name(const ErrorCode enum_val);
|
||||
|
||||
/** The access level necessary to read a property of an interface object. */
|
||||
enum AccessLevel
|
||||
@ -255,7 +255,7 @@ enum AccessLevel
|
||||
WriteLv2 = 0x02,
|
||||
WriteLv3 = 0x03,
|
||||
};
|
||||
const std::string enum_name(const AccessLevel enum_val);
|
||||
const char* enum_name(const AccessLevel enum_val);
|
||||
|
||||
struct PropertyDescription
|
||||
{
|
||||
|
@ -660,7 +660,7 @@ void SecureApplicationLayer::sendSyncRequest(uint16_t dstAddr, bool dstAddrIsGro
|
||||
|
||||
if (secure(request.data() + APDU_LPDU_DIFF, kSecureSyncRequest, _deviceObj.individualAddress(), dstAddr, dstAddrIsGroupAddr, tpci, asdu, sizeof(asdu), secCtrl, systemBcast))
|
||||
{
|
||||
LOGGER.info("SyncRequest: %S", request.apdu().toString());
|
||||
LOGGER.info("SyncRequest: %s", request.apdu().toString().c_str());
|
||||
|
||||
if (_syncReqBroadcastOutgoing)
|
||||
{
|
||||
@ -723,7 +723,7 @@ void SecureApplicationLayer::sendSyncResponse(uint16_t dstAddr, bool dstAddrIsGr
|
||||
{
|
||||
_lastSyncRes = millis();
|
||||
|
||||
LOGGER.info("SyncResponse: %S", response.apdu());
|
||||
LOGGER.info("SyncResponse: %s", response.apdu().c_str());
|
||||
|
||||
if (_syncReqBroadcastIncoming)
|
||||
{
|
||||
@ -1063,7 +1063,7 @@ bool SecureApplicationLayer::decrypt(uint8_t* plainApdu, uint16_t plainApduLengt
|
||||
bool SecureApplicationLayer::decodeSecureApdu(APDU& secureApdu, APDU& plainApdu, SecurityControl& secCtrl)
|
||||
{
|
||||
// Decode secure APDU
|
||||
LOGGER.info("decodeSecureApdu: Secure APDU: %S", secureApdu.toString());
|
||||
LOGGER.info("decodeSecureApdu: Secure APDU: %s", secureApdu.toString().c_str());
|
||||
|
||||
uint16_t srcAddress = secureApdu.frame().sourceAddress();
|
||||
uint16_t dstAddress = secureApdu.frame().destinationAddress();
|
||||
@ -1085,7 +1085,7 @@ bool SecureApplicationLayer::decodeSecureApdu(APDU& secureApdu, APDU& plainApdu,
|
||||
// We are starting from TPCI octet (including): plainApdu.frame().data()+APDU_LPDU_DIFF
|
||||
if (decrypt(plainApdu.frame().data() + APDU_LPDU_DIFF, plainApdu.length() + 1, srcAddress, dstAddress, isDstAddrGroupAddr, tpci, secureApdu.data() + 1, secCtrl, isSystemBroadcast))
|
||||
{
|
||||
LOGGER.info("decodeSecureApdu: Plain APDU: %S", plainApdu.frame().apdu().toString());
|
||||
LOGGER.info("decodeSecureApdu: Plain APDU: %s", plainApdu.frame().apdu().toString().c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1260,7 +1260,7 @@ bool SecureApplicationLayer::createSecureApdu(APDU& plainApdu, APDU& secureApdu,
|
||||
{
|
||||
// Create secure APDU
|
||||
|
||||
LOGGER.info("createSecureApdu: Plain APDU: %S", plainApdu.frame().apdu().toString());
|
||||
LOGGER.info("createSecureApdu: Plain APDU: %s", plainApdu.frame().apdu().toString().c_str());
|
||||
|
||||
uint16_t srcAddress = plainApdu.frame().sourceAddress();
|
||||
uint16_t dstAddress = plainApdu.frame().destinationAddress();
|
||||
@ -1296,7 +1296,7 @@ bool SecureApplicationLayer::createSecureApdu(APDU& plainApdu, APDU& secureApdu,
|
||||
println(nextSequenceNumber(secCtrl.toolAccess), HEX);
|
||||
updateSequenceNumber(secCtrl.toolAccess, nextSequenceNumber(secCtrl.toolAccess) + 1);
|
||||
|
||||
LOGGER.info("createSecureApdu: Secure APDU: %S", secureApdu.frame().apdu().toString());
|
||||
LOGGER.info("createSecureApdu: Secure APDU: %s", secureApdu.frame().apdu().toString().c_str());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ void TransportLayer::groupAddressTable(AddressTableObject& addrTable)
|
||||
|
||||
void TransportLayer::dataIndividualIndication(uint16_t destination, HopCountType hopType, Priority priority, uint16_t source, TPDU& tpdu)
|
||||
{
|
||||
LOGGER.info("dataIndividualIndication %S", tpdu.toString());
|
||||
LOGGER.info("dataIndividualIndication %s", tpdu.toString().c_str());
|
||||
|
||||
uint8_t sequenceNo = tpdu.sequenceNumber();
|
||||
|
||||
@ -331,7 +331,7 @@ void TransportLayer::dataIndividualIndication(uint16_t destination, HopCountType
|
||||
|
||||
void TransportLayer::dataIndividualConfirm(AckType ack, uint16_t destination, HopCountType hopType, Priority priority, TPDU& tpdu, bool status)
|
||||
{
|
||||
LOGGER.info("dataIndividualConfirm %S", tpdu.toString());
|
||||
LOGGER.info("dataIndividualConfirm %s", tpdu.toString().c_str());
|
||||
TpduType type = tpdu.type();
|
||||
|
||||
switch (type)
|
||||
@ -405,7 +405,7 @@ void TransportLayer::dataIndividualConfirm(AckType ack, uint16_t destination, Ho
|
||||
|
||||
void TransportLayer::dataGroupIndication(uint16_t destination, HopCountType hopType, Priority priority, uint16_t source, TPDU& tpdu)
|
||||
{
|
||||
LOGGER.info("dataGroupIndication %S", tpdu.toString());
|
||||
LOGGER.info("dataGroupIndication %s", tpdu.toString().c_str());
|
||||
|
||||
if (_groupAddressTable == nullptr)
|
||||
return;
|
||||
@ -423,31 +423,31 @@ void TransportLayer::dataGroupIndication(uint16_t destination, HopCountType hopT
|
||||
|
||||
void TransportLayer::dataGroupConfirm(AckType ack, uint16_t source, uint16_t destination, HopCountType hopType, Priority priority, TPDU& tpdu, bool status)
|
||||
{
|
||||
LOGGER.info("dataGroupConfirm %S", tpdu.toString());
|
||||
LOGGER.info("dataGroupConfirm %s", tpdu.toString().c_str());
|
||||
_applicationLayer.dataGroupConfirm(ack, hopType, priority, destination, tpdu.apdu(), status);
|
||||
}
|
||||
|
||||
void TransportLayer::dataBroadcastIndication(HopCountType hopType, Priority priority, uint16_t source, TPDU& tpdu)
|
||||
{
|
||||
LOGGER.info("dataBroadcastIndication %S", tpdu.toString());
|
||||
LOGGER.info("dataBroadcastIndication %s", tpdu.toString().c_str());
|
||||
_applicationLayer.dataBroadcastIndication(hopType, priority, source, tpdu.apdu());
|
||||
}
|
||||
|
||||
void TransportLayer::dataBroadcastConfirm(AckType ack, HopCountType hopType, Priority priority, TPDU& tpdu, bool status)
|
||||
{
|
||||
LOGGER.info("dataBroadcastConfirm %S", tpdu.toString());
|
||||
LOGGER.info("dataBroadcastConfirm %s", tpdu.toString().c_str());
|
||||
_applicationLayer.dataBroadcastConfirm(ack, hopType, priority, tpdu.apdu(), status);
|
||||
}
|
||||
|
||||
void TransportLayer::dataSystemBroadcastIndication(HopCountType hopType, Priority priority, uint16_t source, TPDU& tpdu)
|
||||
{
|
||||
LOGGER.info("dataSystemBroadcastIndication %S", tpdu.toString());
|
||||
LOGGER.info("dataSystemBroadcastIndication %s", tpdu.toString().c_str());
|
||||
_applicationLayer.dataSystemBroadcastIndication(hopType, priority, source, tpdu.apdu());
|
||||
}
|
||||
|
||||
void TransportLayer::dataSystemBroadcastConfirm(AckType ack, HopCountType hopType, TPDU& tpdu, Priority priority, bool status)
|
||||
{
|
||||
LOGGER.info("dataSystemBroadcastConfirm %S", tpdu.toString());
|
||||
LOGGER.info("dataSystemBroadcastConfirm %s", tpdu.toString().c_str());
|
||||
_applicationLayer.dataSystemBroadcastConfirm(hopType, priority, tpdu.apdu(), status);
|
||||
}
|
||||
|
||||
@ -458,28 +458,28 @@ void TransportLayer::dataGroupRequest(AckType ack, HopCountType hopType, Priorit
|
||||
|
||||
uint16_t groupAdress = _groupAddressTable->getGroupAddress(tsap);
|
||||
TPDU& tpdu = apdu.frame().tpdu();
|
||||
LOGGER.info("dataGroupRequest %S", tpdu.toString());
|
||||
LOGGER.info("dataGroupRequest %s", tpdu.toString().c_str());
|
||||
_networkLayer->dataGroupRequest(ack, groupAdress, hopType, priority, tpdu);
|
||||
}
|
||||
|
||||
void TransportLayer::dataBroadcastRequest(AckType ack, HopCountType hopType, Priority priority, APDU& apdu)
|
||||
{
|
||||
TPDU& tpdu = apdu.frame().tpdu();
|
||||
LOGGER.info("dataBroadcastRequest %S", tpdu.toString());
|
||||
LOGGER.info("dataBroadcastRequest %s", tpdu.toString().c_str());
|
||||
_networkLayer->dataBroadcastRequest(ack, hopType, priority, tpdu);
|
||||
}
|
||||
|
||||
void TransportLayer::dataSystemBroadcastRequest(AckType ack, HopCountType hopType, Priority priority, APDU& apdu)
|
||||
{
|
||||
TPDU& tpdu = apdu.frame().tpdu();
|
||||
LOGGER.info("dataSystemBroadcastRequest %S", tpdu.toString());
|
||||
LOGGER.info("dataSystemBroadcastRequest %s", tpdu.toString().c_str());
|
||||
return _networkLayer->dataSystemBroadcastRequest(ack, hopType, priority, tpdu);
|
||||
}
|
||||
|
||||
void TransportLayer::dataIndividualRequest(AckType ack, HopCountType hopType, Priority priority, uint16_t destination, APDU& apdu)
|
||||
{
|
||||
TPDU& tpdu = apdu.frame().tpdu();
|
||||
LOGGER.info("dataIndividualRequest %S", tpdu.toString());
|
||||
LOGGER.info("dataIndividualRequest %s", tpdu.toString().c_str());
|
||||
_networkLayer->dataIndividualRequest(ack, destination, hopType, priority, tpdu);
|
||||
}
|
||||
|
||||
@ -641,7 +641,7 @@ void TransportLayer::sendControlTelegram(TpduType pduType, uint8_t seqNo)
|
||||
TPDU& tpdu = frame.tpdu();
|
||||
tpdu.type(pduType);
|
||||
tpdu.sequenceNumber(seqNo);
|
||||
LOGGER.info("sendControlTelegram %S", tpdu.toString());
|
||||
LOGGER.info("sendControlTelegram %s", tpdu.toString().c_str());
|
||||
_networkLayer->dataIndividualRequest(AckRequested, _connectionAddress, NetworkLayerParameter,
|
||||
SystemPriority, tpdu);
|
||||
}
|
||||
|
@ -2,66 +2,66 @@
|
||||
|
||||
#include "../bits.h"
|
||||
|
||||
Map<std::string, Logger::LogType, 64> Logger::_loggers;
|
||||
Map<const char*, Logger::LogType, 64> Logger::_loggers;
|
||||
Logger Logger::_logger;
|
||||
|
||||
Logger& Logger::logger(const std::string name)
|
||||
Logger& Logger::logger(const char* name)
|
||||
{
|
||||
_logger.name(name);
|
||||
return _logger;
|
||||
}
|
||||
|
||||
void Logger::logLevel(const std::string name, LogType level)
|
||||
void Logger::logLevel(const char* name, LogType level)
|
||||
{
|
||||
_loggers.insertOrAssign(name, level);
|
||||
}
|
||||
|
||||
void Logger::info(const std::string message, ...)
|
||||
void Logger::info(const char* message, ...)
|
||||
{
|
||||
#ifndef KNX_NO_PRINT
|
||||
va_list objects;
|
||||
va_start( objects, message);
|
||||
log(LogType::Info, message.c_str(), objects);
|
||||
log(LogType::Info, message, objects);
|
||||
va_end(objects);
|
||||
#endif
|
||||
}
|
||||
|
||||
void Logger::warning(const std::string message, ...)
|
||||
void Logger::warning(const char* message, ...)
|
||||
{
|
||||
#ifndef KNX_NO_PRINT
|
||||
va_list objects;
|
||||
va_start( objects, message);
|
||||
log(LogType::Warning, message.c_str(), objects);
|
||||
log(LogType::Warning, message, objects);
|
||||
va_end(objects);
|
||||
#endif
|
||||
}
|
||||
|
||||
void Logger::error(const std::string message, ...)
|
||||
void Logger::error(const char* message, ...)
|
||||
{
|
||||
#ifndef KNX_NO_PRINT
|
||||
va_list objects;
|
||||
va_start( objects, message);
|
||||
log(LogType::Error, message.c_str(), objects);
|
||||
log(LogType::Error, message, objects);
|
||||
va_end(objects);
|
||||
#endif
|
||||
}
|
||||
|
||||
void Logger::critical(const std::string message, ...)
|
||||
void Logger::critical(const char* message, ...)
|
||||
{
|
||||
#ifndef KNX_NO_PRINT
|
||||
va_list objects;
|
||||
va_start( objects, message);
|
||||
log(LogType::Critical, message.c_str(), objects);
|
||||
log(LogType::Critical, message, objects);
|
||||
va_end(objects);
|
||||
#endif
|
||||
}
|
||||
|
||||
void Logger::exception(const std::string message, ...)
|
||||
void Logger::exception(const char* message, ...)
|
||||
{
|
||||
#ifndef KNX_NO_PRINT
|
||||
va_list objects;
|
||||
va_start( objects, message);
|
||||
log(LogType::Exception, message.c_str(), objects);
|
||||
log(LogType::Exception, message, objects);
|
||||
va_end(objects);
|
||||
#endif
|
||||
}
|
||||
@ -72,9 +72,9 @@ void Logger::log(LogType type, const char* format, va_list args)
|
||||
LogType* level = _loggers.get(_name);
|
||||
if(level == nullptr) {
|
||||
print("Logger ");
|
||||
print(_name.c_str());
|
||||
print(_name);
|
||||
print(" is disabled. Use Logger::logLevel(\"");
|
||||
print(_name.c_str());
|
||||
print(_name);
|
||||
println("\", Logger::Info) to enable.");
|
||||
_loggers.insertOrAssign(_name, Disabled);
|
||||
return;
|
||||
@ -85,9 +85,9 @@ void Logger::log(LogType type, const char* format, va_list args)
|
||||
|
||||
print(millis());
|
||||
print(" ");
|
||||
print(_name.c_str());
|
||||
print(_name);
|
||||
print("\t");
|
||||
print(enum_name(type).c_str());
|
||||
print(enum_name(type));
|
||||
print(" ");
|
||||
|
||||
while (*format)
|
||||
@ -104,10 +104,6 @@ void Logger::log(LogType type, const char* format, va_list args)
|
||||
{
|
||||
print(va_arg(args, char*));
|
||||
}
|
||||
else if (*format == 'S')
|
||||
{
|
||||
print(va_arg(args, std::string).c_str());
|
||||
}
|
||||
else if (*format == 'f')
|
||||
{
|
||||
print(va_arg(args, double));
|
||||
@ -126,7 +122,7 @@ void Logger::log(LogType type, const char* format, va_list args)
|
||||
#endif
|
||||
}
|
||||
#ifndef KNX_NO_PRINT
|
||||
const std::string Logger::enum_name(LogType type)
|
||||
const char* Logger::enum_name(LogType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
@ -149,6 +145,6 @@ const std::string Logger::enum_name(LogType type)
|
||||
return "DISA";
|
||||
}
|
||||
|
||||
return std::to_string(type);
|
||||
return "";
|
||||
}
|
||||
#endif
|
||||
|
@ -1,26 +1,23 @@
|
||||
#include <stdarg.h>
|
||||
#include <string>
|
||||
#include "simple_map.h"
|
||||
|
||||
class NoOpLogger;
|
||||
class Logger
|
||||
{
|
||||
public:
|
||||
enum LogType { Info, Warning, Error, Critical, Exception, Disabled};
|
||||
static Logger& logger(const std::string name);
|
||||
static void logLevel(const std::string name, LogType level);
|
||||
void info(const std::string message, ...);
|
||||
void warning(const std::string message, ...);
|
||||
void error(const std::string message, ...);
|
||||
void critical(const std::string message, ...);
|
||||
void exception(const std::string message, ...);
|
||||
static Logger& logger(const char* name);
|
||||
static void logLevel(const char* name, LogType level);
|
||||
void info(const char* message, ...);
|
||||
void warning(const char* message, ...);
|
||||
void error(const char* message, ...);
|
||||
void critical(const char* message, ...);
|
||||
void exception(const char* message, ...);
|
||||
protected:
|
||||
Logger() {}
|
||||
void log(LogType type, const char* format, va_list args);
|
||||
void name(std::string value) { _name = value; }
|
||||
void name(const char* value) { _name = value; }
|
||||
private:
|
||||
const std::string enum_name(LogType type);
|
||||
std::string _name = "";
|
||||
static Map<std::string, LogType, 64> _loggers;
|
||||
const char* enum_name(LogType type);
|
||||
const char* _name = "";
|
||||
static Map<const char*, LogType, 64> _loggers;
|
||||
static Logger _logger;
|
||||
};
|
Loading…
Reference in New Issue
Block a user