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

Bug fixed #2

Open
andreucci opened this issue Oct 17, 2014 · 0 comments
Open

Bug fixed #2

andreucci opened this issue Oct 17, 2014 · 0 comments

Comments

@andreucci
Copy link

Bug fixed on MQTT.java: mqtt.retain il the last bit of the first byte, not on the second byte

public static MQTTMessage decode(byte[] message) {
    int i = 0;
    MQTTMessage mqtt = new MQTTMessage();
    mqtt.type = (message[i] >> 4) & 0x0F;
    mqtt.DUP = ((message[i] >> 3) & 0x01) == 0 ? false : true;
    mqtt.QoS = (message[i] >> 1) & 0x03;
     //mqtt.retain = (message[i++] & 0x01) == 0 ? false : true;    // credo che l' i++ sia sbagliato
    mqtt.retain = (message[i] & 0x01) == 0 ? false : true;

Then an i++ should be added before :

    switch (mqtt.type) {
    case CONNECT:

There is also something to fix after that to mage the message[0] work.
I still have the problem that I send a byte and I receive, on android side, a char. Any idea?

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