From 8710e75a931d67bdd05396b40b3e6fd02c3fc114 Mon Sep 17 00:00:00 2001 From: Joel Wetzell Date: Wed, 23 Oct 2024 16:46:12 -0500 Subject: [PATCH] update example in README --- README.md | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 927ebdd..28a51d1 100644 --- a/README.md +++ b/README.md @@ -13,8 +13,16 @@ typesecript implementation of the [PosiStageNet protocol](https://github.com/vyv const { Decoder } = require('@jwetzell/posistagenet') const decoder = new Decoder() -const infoPacketBuffer = Buffer.from('5667348000000c0001000000000000000203010101000b00536572766572204e616d650200118001000d8000000900547261636b65722031','hex') -const dataPacketBuffer = Buffer.from('5567288000000c00010000000000000002030101010014800100108000000c000000803f0000803f0000803f','hex') +const infoPacketBuffer = new Uint8Array([ + 0x56, 0x67, 0x34, 0x80, 0x00, 0x00, 0x0c, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x03, 0x01, + 0x01, 0x01, 0x00, 0x0b, 0x00, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x20, 0x4e, 0x61, 0x6d, 0x65, 0x02, 0x00, 0x11, + 0x80, 0x01, 0x00, 0x0d, 0x80, 0x00, 0x00, 0x09, 0x00, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x65, 0x72, 0x20, 0x31, +]); +const dataPacketBuffer = new Uint8Array([ + 0x55, 0x67, 0x28, 0x80, 0x00, 0x00, 0x0c, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x03, 0x01, + 0x01, 0x01, 0x00, 0x14, 0x80, 0x01, 0x00, 0x10, 0x80, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, + 0x80, 0x3f, 0x00, 0x00, 0x80, 0x3f, +]); decoder.decode(infoPacketBuffer) decoder.decode(dataPacketBuffer) @@ -49,12 +57,12 @@ const infoPackets = encoder.getInfoPackets(timestamp, trackers) dataPackets.forEach((dataPacket)=>{ console.log('send packet somehow') - console.log(dataPacket.toString('hex')) + console.log(dataPacket) }) infoPackets.forEach((infoPacket)=>{ console.log('send packet somehow') - console.log(infoPacket.toString('hex')) + console.log(infoPacket) }) ```