From 6aa511f2ae3d5c84e7db02627ffd4d7f6796ce75 Mon Sep 17 00:00:00 2001 From: Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> Date: Sun, 17 Sep 2023 18:24:18 +0300 Subject: decide what message types are left --- pkg/messages/types/svcPacketEntities.go | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'pkg/messages/types/svcPacketEntities.go') diff --git a/pkg/messages/types/svcPacketEntities.go b/pkg/messages/types/svcPacketEntities.go index 54e4a2a..2d86bf2 100644 --- a/pkg/messages/types/svcPacketEntities.go +++ b/pkg/messages/types/svcPacketEntities.go @@ -5,33 +5,30 @@ import ( ) type SvcPacketEntities struct { - MaxEntries int16 + MaxEntries uint16 IsDelta bool DeltaFrom int32 BaseLine bool - UpdatedEntries int16 - Length int32 + UpdatedEntries uint16 + Length uint32 UpdatedBaseline bool Data []byte } func ParseSvcPacketEntities(reader *bitreader.Reader) SvcPacketEntities { svcPacketEntities := SvcPacketEntities{ - MaxEntries: int16(reader.TryReadBits(11)), + MaxEntries: uint16(reader.TryReadBits(11)), IsDelta: reader.TryReadBool(), } if svcPacketEntities.IsDelta { - svcPacketEntities.DeltaFrom = int32(reader.TryReadBits(32)) + svcPacketEntities.DeltaFrom = reader.TryReadSInt32() } else { svcPacketEntities.DeltaFrom = -1 } svcPacketEntities.BaseLine = reader.TryReadBool() - svcPacketEntities.UpdatedEntries = int16(reader.TryReadBits(11)) - svcPacketEntities.Length = int32(reader.TryReadBits(20)) + svcPacketEntities.UpdatedEntries = uint16(reader.TryReadBits(11)) + svcPacketEntities.Length = uint32(reader.TryReadBits(20)) svcPacketEntities.UpdatedBaseline = reader.TryReadBool() - svcPacketEntities.Data = reader.TryReadBitsToSlice(uint64(svcPacketEntities.Length)) //, dataReader = reader.ForkAndSkip(int(svcPacketEntities.Length)) - // for count := 0; count < int(svcPacketEntities.UpdatedEntries); count++ { - // dataReader.TryReadBool() - // } + svcPacketEntities.Data = reader.TryReadBitsToSlice(uint64(svcPacketEntities.Length)) return svcPacketEntities } -- cgit v1.2.3