Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Willretain flag has wrong bit position #13

Open
StefanGrube opened this issue Jul 24, 2020 · 0 comments
Open

Willretain flag has wrong bit position #13

StefanGrube opened this issue Jul 24, 2020 · 0 comments

Comments

@StefanGrube
Copy link

The bit position of the "WillRetain" flag is according to MQTT v3.1.1: CONNECT message: Variable Header - Byte 8: Connect Flags
Bit 7: User Name Flag ($80)
Bit 6: Password Flag ($40)
Bit 5: Will Retain Flag ($20)
Bits 4-3: Will QoS ($18)
Bit 2: Will Flag ($04)
Bit 1: Clean Session ($02)
Bit 0: 0 (Reserved) ($01)

So the bit position of the "WillRetain" flag must be corrected to $20 in:
-> procedure TMQTTParser.SendConnect(aClientID, aUsername, aPassword : UTF8String;
if WillRetain then
x := x or $20;
-> procedure TMQTTParser.Parse(aStream: TStream);
wr := (fl and $20) > 0; // will retain
-> procedure TMQTTParser.SendBrokerConnect(aClientID, aUsername,
if WillRetain then
x := x or $20;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant