0C001A0001000800030000010501000000800100001003103F002A00
La página 0 de datos de composición anterior se puede describir de la siguiente manera:
0C00 1A00 0100 0800 0300 0001 05 01 0000 0080 0100 0010 0310 3F002A00
0x000C0x001A0x00010x00080x0003 : funciones de retransmisión y amigo.0x0100510x0000 , 0x8000 , 0x0001 , 0x1000 , 0x100Nota: Los datos de composición son little-endian.
Conozco el uso de Arraybuffer y matrices sin tipo, pero estoy confundido acerca de cómo establecer el desplazamiento de acuerdo con la extracción de diferentes ID y modelos SIG. Tengo que hacer cambios en este código (extrayendo los primeros 4 ID), en particular:
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)) }