Teltonika protocol

jack s4 years ago

Hello,
I checked your last update on Teltonika protocol decoder and found this function:

private boolean isPrintable(ByteBuf buf, int length) {
        boolean printable = true;
        for (int i = 0; i < length; i++) {
            byte b = buf.getByte(buf.readerIndex() + i);
            if (b < 32 && b != '\r' && b != '\n') {
                printable = false;
                break;
            }
        }
        return printable;
    }

Could you please explain the purpose of this function?
thank you.

Anton Tananaev4 years ago

It checks if buffer contains a string value.

jack s4 years ago

Thank you a lot.