aboutsummaryrefslogtreecommitdiff
path: root/pkg/messages/types/svcVoiceData.go
blob: efcae859762b6a1839e561ffeedfbd25ee83c947 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package messages

import "github.com/pektezol/bitreader"

type SvcVoiceData struct {
	FromClient uint8
	Proximity  bool
	Length     int16
	Data       []byte
}

func ParseSvcVoiceData(reader *bitreader.Reader) SvcVoiceData {
	svcVoiceData := SvcVoiceData{
		FromClient: reader.TryReadUInt8(),
	}
	proximity := reader.TryReadUInt8()
	if proximity != 0 {
		svcVoiceData.Proximity = true
	}
	svcVoiceData.Data = reader.TryReadBitsToSlice(uint64(svcVoiceData.Length))
	return svcVoiceData
}