Skip to content

Commit

Permalink
Merge branch 'develop' into feature/serialinputhandler-cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
hhvrc committed Sep 6, 2024
2 parents cf57cfd + ffc3d93 commit fabb65c
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
18 changes: 9 additions & 9 deletions include/Convert.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
#include <string_view>

namespace OpenShock::Convert {
bool FromInt8(std::string_view str, int8_t& val);
bool FromUint8(std::string_view str, uint8_t& val);
bool FromInt16(std::string_view str, int16_t& val);
bool FromUint16(std::string_view str, uint16_t& val);
bool FromInt32(std::string_view str, int32_t& val);
bool FromUint32(std::string_view str, uint32_t& val);
bool FromInt64(std::string_view str, int64_t& val);
bool FromUint64(std::string_view str, uint64_t& val);
bool FromBool(std::string_view str, bool& val);
bool ToInt8(std::string_view str, int8_t& val);
bool ToUint8(std::string_view str, uint8_t& val);
bool ToInt16(std::string_view str, int16_t& val);
bool ToUint16(std::string_view str, uint16_t& val);
bool ToInt32(std::string_view str, int32_t& val);
bool ToUint32(std::string_view str, uint32_t& val);
bool ToInt64(std::string_view str, int64_t& val);
bool ToUint64(std::string_view str, uint64_t& val);
bool ToBool(std::string_view str, bool& val);
} // namespace OpenShock::Convert
18 changes: 9 additions & 9 deletions src/Convert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,31 +103,31 @@ constexpr bool spanToST(std::string_view str, T& val) {
using namespace OpenShock;

// Specific converters
bool Convert::FromInt8(std::string_view str, int8_t& val) {
bool Convert::ToInt8(std::string_view str, int8_t& val) {
return spanToST(str, val);
}
bool Convert::FromUint8(std::string_view str, uint8_t& val) {
bool Convert::ToUint8(std::string_view str, uint8_t& val) {
return spanToUT(str, val);
}
bool Convert::FromInt16(std::string_view str, int16_t& val) {
bool Convert::ToInt16(std::string_view str, int16_t& val) {
return spanToST(str, val);
}
bool Convert::FromUint16(std::string_view str, uint16_t& val) {
bool Convert::ToUint16(std::string_view str, uint16_t& val) {
return spanToUT(str, val);
}
bool Convert::FromInt32(std::string_view str, int32_t& val) {
bool Convert::ToInt32(std::string_view str, int32_t& val) {
return spanToST(str, val);
}
bool Convert::FromUint32(std::string_view str, uint32_t& val) {
bool Convert::ToUint32(std::string_view str, uint32_t& val) {
return spanToUT(str, val);
}
bool Convert::FromInt64(std::string_view str, int64_t& val) {
bool Convert::ToInt64(std::string_view str, int64_t& val) {
return spanToST(str, val);
}
bool Convert::FromUint64(std::string_view str, uint64_t& val) {
bool Convert::ToUint64(std::string_view str, uint64_t& val) {
return spanToUT(str, val);
}
bool Convert::FromBool(std::string_view str, bool& val) {
bool Convert::ToBool(std::string_view str, bool& val) {
if (str.length() > 5) {
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion src/GatewayClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ void GatewayClient::_handleEvent(WStype_t type, uint8_t* payload, std::size_t le
OS_LOGD(TAG, "Received ping from API");
break;
case WStype_PONG:
OS_LOGD(TAG, "Received pong from API");
OS_LOGV(TAG, "Received pong from API");
break;
case WStype_BIN:
EventHandlers::WebSocket::HandleGatewayBinary(payload, length);
Expand Down
2 changes: 1 addition & 1 deletion src/util/IPAddressUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ bool OpenShock::IPV4AddressFromStringView(IPAddress& ip, std::string_view sv) {
}

std::uint8_t octets[4];
if (!Convert::FromUint8(parts[0], octets[0]) || !Convert::FromUint8(parts[1], octets[1]) || !Convert::FromUint8(parts[2], octets[2]) || !Convert::FromUint8(parts[3], octets[3])) {
if (!Convert::ToUint8(parts[0], octets[0]) || !Convert::ToUint8(parts[1], octets[1]) || !Convert::ToUint8(parts[2], octets[2]) || !Convert::ToUint8(parts[3], octets[3])) {
return false;
}

Expand Down

0 comments on commit fabb65c

Please sign in to comment.