Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

167
Views
How can I extract NumS , NumV , Sig Models from sequence of string octets which is basically a composition data?

0C001A0001000800030000010501000000800100001003103F002A00

The above Composition Data Page 0 can be described as follows:

0C00 1A00 0100 0800 0300 0001 05 01 0000 0080 0100 0010 0310 3F002A00

  • CID is 0x000C
  • PID is 0x001A
  • VID is 0x0001
  • CRPL is 0x0008
  • Features is 0x0003 – Relay and Friend features.
  • Loc is "front" – 0x0100
  • NumS is 5
  • NumV is 1
  • The Bluetooth SIG Models supported are:
    • 0x0000, 0x8000, 0x0001, 0x1000, 0x100

Note: The composition data is little-endian.

I know the usage of Arraybuffer and untyped arrays but confused about how to set offset according to extraction of different IDs and SIG Models. I have to make changes in this code (extracting first 4 IDs), particularly:

var string  = "0123 4567 89AB";

var string1 =  string.split(" ").join(""); 
          
var buf = new ArrayBuffer(string1.length/2); 

var hex = new Uint16Array(buf)
     
for (var i=0, strLen=string1.length; i < strLen; i+=4){

    hex[i/4] = 0


    hex[i/4] += (parseInt(string1[i+0],16) << (4*1))
    hex[i/4] += (parseInt(string1[i+1],16) << (4*0))
    hex[i/4] += (parseInt(string1[i+2],16) << (4*3))
    hex[i/4] += (parseInt(string1[i+3],16) << (4*2))
}

for (var i=0, strLen=string1.length; i < strLen/4; i++){

    document.write("0x0" + hex[i].toString(16))
}
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!