Skip to content

how can I get the proper value when using BLE GATT and Hex Values #457

Closed Answered by mutasimissa
ahunter135 asked this question in Q&A
Discussion options

You must be logged in to vote

ok, please work more with JS DataView, it has some learning curve but it's important to understand how buffers are represented in a DataView

  • First of all we are looping on a DataView which has different characteristics of normal arrays or objects, but yes you can use for loop to loop throw its bytes
  • I used byteLength which is similar to Array.length but for DataView
  • After reviewing the code I wrote I think I'm mistaken 😖 so here is a complete step-by-step code that will make more sense
// lets create a buffer that has "room" of 8 bytes
const buffer = new ArrayBuffer(8);

// let's create a DataView of that buffer
const data = new DataView(buffer)

// let's add to the dataview int32 which…

Replies: 7 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by pwespi
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #456 on December 11, 2022 09:40.