mirror of
https://github.com/meshtastic/firmware.git
synced 2026-01-30 05:32:08 +00:00
I thought git would be smart enough to understand all the whitespace changes but even with all the flags I know to make it ignore theses it still blows up if there are identical changes on both sides.
I have a solution but it require creating a new commit at the merge base for each conflicting PR and merging it into develop.
I don't think blowing up all PRs is worth for now, maybe if we can coordinate this for V3 let's say.
This reverts commit 0d11331d18.
23 lines
721 B
C++
23 lines
721 B
C++
#include <meshtastic/mesh.pb.h>
|
|
#include <string>
|
|
|
|
static const char hexChars[16] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
|
|
|
|
class MeshPacketSerializer
|
|
{
|
|
public:
|
|
static std::string JsonSerialize(const meshtastic_MeshPacket *mp, bool shouldLog = true);
|
|
static std::string JsonSerializeEncrypted(const meshtastic_MeshPacket *mp);
|
|
|
|
private:
|
|
static std::string bytesToHex(const uint8_t *bytes, int len)
|
|
{
|
|
std::string result = "";
|
|
for (int i = 0; i < len; ++i) {
|
|
char const byte = bytes[i];
|
|
result += hexChars[(byte & 0xF0) >> 4];
|
|
result += hexChars[(byte & 0x0F) >> 0];
|
|
}
|
|
return result;
|
|
}
|
|
}; |