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

Prefix or not? #10

Closed
andersborgabiro opened this issue Oct 23, 2019 · 1 comment
Closed

Prefix or not? #10

andersborgabiro opened this issue Oct 23, 2019 · 1 comment

Comments

@andersborgabiro
Copy link

andersborgabiro commented Oct 23, 2019

Is it given that there will always be a prefix, considering this code always slices off the first character in the byte array when parsing, or is it known whether that will be the case beforehand?

I did this as a fail-safe. This is not the exact same context, but you see what I do anyway. Sorry for no use of let etc.

    var payload = "";
    var first = record.payload[0];
    if (first < 32) {
        payload = nfcProtocols[first] + nfc.bytesToString(record.payload.slice(1));
    } else {
        payload = nfc.bytesToString(record.payload);
    }

i also noted there are more than 32 elements in the array.

@andersborgabiro
Copy link
Author

I figured it out: when type is 85 there's always a prefix that can be from 0 to 35.

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