Public
Edited
Mar 14
Insert cell
Insert cell
Insert cell
Insert cell
example_msg = "8c4841753a9a153237aef0f275be"
Insert cell
rs1090.decode(example_msg)
Insert cell
Insert cell
b = hexStringToU8Array(example_msg)
Insert cell
Insert cell
df = b[0] >> 3 // The 5 first bits are the downlink format (8 bits shifted by 3 = 5 bits)
Insert cell
Insert cell
icao24 = example_msg.slice(2, 8)
Insert cell
tc = b[4] >> 3 // The 5 first bits of the 5th block
Insert cell
Insert cell
rs1090.decode("8c4841753a9a153237aef0f275bf")
Insert cell
Insert cell
df20_message = "a0001838e519f33160240142d7fa"
Insert cell
df21_message = "a8001ebcfffb23286004a73f6a5b"
Insert cell
Insert cell
rs1090.decode(df20_message).icao24
Insert cell
rs1090.decode("a0001838e519f33160240142d7fb").icao24 // no CRC-check
Insert cell
Insert cell
rs1090.decode(df20_message)
Insert cell
rs1090.decode("210000991bb795") // DF 4 messages are shorter
Insert cell
rs1090.decode(df21_message)
Insert cell
rs1090.decode("2b20178d67e392") // DF 5 messages are shorter too
Insert cell
Insert cell
rs1090.decode_bds05(df20_message)
Insert cell
rs1090.decode_bds10(df20_message)
Insert cell
rs1090.decode_bds17(df20_message)
Insert cell
rs1090.decode_bds20(df20_message)
Insert cell
rs1090.decode_bds21(df20_message)
Insert cell
rs1090.decode_bds30(df20_message)
Insert cell
rs1090.decode_bds40(df20_message)
Insert cell
rs1090.decode_bds44(df20_message)
Insert cell
rs1090.decode_bds45(df20_message)
Insert cell
rs1090.decode_bds50(df20_message)
Insert cell
rs1090.decode_bds60(df20_message)
Insert cell
rs1090.decode_bds65(df20_message) // should be an error since not 31
Insert cell
Insert cell
rs1090.decode(df20_message)
Insert cell
Insert cell
rs1090.decode(df21_message)
Insert cell
Insert cell
Insert cell
rs1090_unpkg = {
let module = await import("https://unpkg.com/rs1090-wasm/web/rs1090_wasm.js");
await module.default("https://unpkg.com/rs1090-wasm/web/rs1090_wasm_bg.wasm");
module.run(); // get better error messages if the Rust code panics
return module;
}
Insert cell
Insert cell
function hexStringToU8Array(hexString) {
if (hexString.length % 2 !== 0) {
throw new Error("Invalid hex string length");
}

const u8Array = new Uint8Array(hexString.length / 2);
for (let i = 0; i < hexString.length; i += 2) {
u8Array[i / 2] = parseInt(hexString.slice(i, i + 2), 16);
}
return u8Array;
}
Insert cell
hexStringToU8Array("2b20178d67e392")
Insert cell
Insert cell
rs1090_dev = {
let module = await import("http://localhost:8765/pkg/web/rs1090_wasm.js");
await module.default("http://localhost:8765/pkg/web/rs1090_wasm_bg.wasm");
module.run();
return module;
}
Insert cell
Insert cell
rs1090.decode("a0ef") // Message too short
Insert cell
rs1090.decode("a0efa0efa0efa0efa0efa0efa0efa0") // Message too long
Insert cell
rs1090.decode("8c4841753a9a153237aef0f275bg") // Non hexa-decimal data
Insert cell
rs1090.airport_information("toulouse")[0]
Insert cell
rs1090.aircraft_information("4ca7b5")
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more