kopia lustrzana https://github.com/weetmuts/wmbusmeters
Use underline instead of hash for border between header and data, since hash does not work in urls.
rodzic
b9a0823c85
commit
cd974697fb
|
@ -178,6 +178,7 @@ bool isHexString(const char* txt, bool *invalid, bool strict)
|
|||
if (!strict && c == '#') continue; // Ignore hashes if not strict
|
||||
if (!strict && c == ' ') continue; // Ignore hashes if not strict
|
||||
if (!strict && c == '|') continue; // Ignore hashes if not strict
|
||||
if (!strict && c == '_') continue; // Ignore underlines if not strict
|
||||
if (c == 0) break;
|
||||
n++;
|
||||
if (char2int(c) == -1) return false;
|
||||
|
@ -213,8 +214,8 @@ bool hex2bin(const char* src, vector<uchar> *target)
|
|||
{
|
||||
if (!src) return false;
|
||||
while(*src && src[1]) {
|
||||
if (*src == ' ' || *src == '#' || *src == '|') {
|
||||
// Ignore space and hashes and pipes.
|
||||
if (*src == ' ' || *src == '#' || *src == '|' || *src == '_') {
|
||||
// Ignore space and hashes and pipes and underlines.
|
||||
src++;
|
||||
} else {
|
||||
int hi = char2int(*src);
|
||||
|
@ -1013,7 +1014,7 @@ void logTelegram(vector<uchar> &original, vector<uchar> &parsed, int header_size
|
|||
string content = parsed_hex.substr(header_size*2);
|
||||
if (suffix_size == 0)
|
||||
{
|
||||
notice("telegram=|%s#%s|+%ld\n",
|
||||
notice("telegram=|%s_%s|+%ld\n",
|
||||
header.c_str(), content.c_str(), diff);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -53,7 +53,7 @@ fi
|
|||
|
||||
RES=$(cat $TEST/thelog2.txt | tr '\n' ' ' | tr -d ' ')
|
||||
|
||||
EXP=$(printf 'telegram=|A244EE4D785634123C067A8F000000#0C1348550000426CE1F14C130000000082046C21298C0413330000008D04931E3A3CFE3300000033000000330000003300000033000000330000003300000033000000330000003300000033000000330000004300000034180000046D0D0B5C2B03FD6C5E150082206C5C290BFD0F0200018C4079678885238310FD3100000082106C01018110FD610002FD66020002FD170000|+0 telegram=|A244EE4D111111113C077AAC000000#0C1389490000426CE1F14C130000000082046C21298C0413010000008D04931E3A3CFE0100000001000000010000000100000001000000010000000100000001000000010000000100000001000000010000001600000031130000046D0A0C5C2B03FD6C60150082206C5C290BFD0F0200018C4079629885238310FD3100000082106C01018110FD610002FD66020002FD170000|+0 telegram=|1E44AE4C9956341268077A36001000#2F2F0413181E0000023B00002F2F2F2F|+0 telegram=|1844AE4C4455223368077A55000000#041389E20100023B0000|+0' | tr '\n' ' ' | tr -d ' ')
|
||||
EXP=$(printf 'telegram=|A244EE4D785634123C067A8F000000_0C1348550000426CE1F14C130000000082046C21298C0413330000008D04931E3A3CFE3300000033000000330000003300000033000000330000003300000033000000330000003300000033000000330000004300000034180000046D0D0B5C2B03FD6C5E150082206C5C290BFD0F0200018C4079678885238310FD3100000082106C01018110FD610002FD66020002FD170000|+0 telegram=|A244EE4D111111113C077AAC000000_0C1389490000426CE1F14C130000000082046C21298C0413010000008D04931E3A3CFE0100000001000000010000000100000001000000010000000100000001000000010000000100000001000000010000001600000031130000046D0A0C5C2B03FD6C60150082206C5C290BFD0F0200018C4079629885238310FD3100000082106C01018110FD610002FD66020002FD170000|+0 telegram=|1E44AE4C9956341268077A36001000_2F2F0413181E0000023B00002F2F2F2F|+0 telegram=|1844AE4C4455223368077A55000000_041389E20100023B0000|+0' | tr '\n' ' ' | tr -d ' ')
|
||||
|
||||
if [ "$RES" != "$EXP" ]
|
||||
then
|
||||
|
|
Ładowanie…
Reference in New Issue