Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

181
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda