From d65b2f2d4c272700e23d510f6cec9da812186d87 Mon Sep 17 00:00:00 2001 From: Jonathan Barrow Date: Fri, 7 Apr 2023 19:35:34 -0400 Subject: [PATCH] Added Station URL methods to StreamIn --- stream_in.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/stream_in.go b/stream_in.go index aa55bda7..3b8f8b4a 100644 --- a/stream_in.go +++ b/stream_in.go @@ -201,6 +201,17 @@ func (stream *StreamIn) ReadDataHolder() *DataHolder { return dataHolder } +// ReadStationURL reads a StationURL type +func (stream *StreamIn) ReadStationURL() *StationURL { + stationString, err := stream.ReadString() + if err != nil { + // TODO - Make this maybe return an error? + logger.Error(err.Error()) + } + + return NewStationURL(stationString) +} + // ReadListUInt8 reads a list of uint8 types func (stream *StreamIn) ReadListUInt8() []uint8 { length := stream.ReadUInt32LE() @@ -292,6 +303,19 @@ func (stream *StreamIn) ReadListQBuffer() [][]byte { return list } +// ReadListStationURL reads a list of NEX Station URL types +func (stream *StreamIn) ReadListStationURL() []*StationURL { + length := stream.ReadUInt32LE() + list := make([]*StationURL, 0, length) + + for i := 0; i < int(length); i++ { + value := stream.ReadStationURL() + list = append(list, value) + } + + return list +} + // ReadListStructure reads and returns a list structure types func (stream *StreamIn) ReadListStructure(structure StructureInterface) (interface{}, error) { length := stream.ReadUInt32LE()