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

Only convert to Uint8Array when sending to the device #1004

Open
murkle opened this issue May 23, 2023 · 0 comments
Open

Only convert to Uint8Array when sending to the device #1004

murkle opened this issue May 23, 2023 · 0 comments

Comments

@murkle
Copy link

murkle commented May 23, 2023

I think you can simplify the code a little by always working with JavaScript Array() and only convert to Uint8Array when sending to the device, eg remove new Uint8Array here and then things like Array.concat() are available

const DISCONNECT = new Uint8Array([0x54]);
const GET_INFO = new Uint8Array([0x55]);
const GET_STATUS = new Uint8Array([0x10]);
const GET_SENSOR_IDS = new Uint8Array([0x51]);
const GET_SENSOR_INFO = new Uint8Array([0x50, 0x00]);
const GET_DEFAULT_SENSORS_MASK = new Uint8Array([0x56]);
``
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