-
Notifications
You must be signed in to change notification settings - Fork 44
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
v2: use a byte array for the characteristics bitfield #240
Labels
P3
Low: Not priority right now
Comments
Another note: we could also define nice user-friendly APIs, such as:
This sorta assumes that all characteristics will be booleans, but I think that's the idea. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Right now, characteristics is as follows:
And, as per the code, it encodes and decodes as little-endian.
If Go had a uint128 type, I'd definitely agree with this approach. For better or worse it doesn't, so using
encoding/binary.LittleEndian
doesn't save us complexity - we still have to choose between Hi and Lo.I think it would be easier to use
[16]byte
, as proposed by @rvagg here: #239 (comment)Then the logic should also become fairly straightforward to follow. For example, a "get bit" or "set bit" method on Characteristics would use
pos/8
to select an array index, andpos%8
to select the bit within its byte.The text was updated successfully, but these errors were encountered: