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

import (
	"github.com/pektezol/bitreader"
	"github.com/pektezol/sdp.go/pkg/writer"
)

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))
	writer.TempAppendLine("\t\tFrom Client: %d", svcVoiceData.FromClient)
	writer.TempAppendLine("\t\tProximity: %t", svcVoiceData.Proximity)
	writer.TempAppendLine("\t\tData: %v", svcVoiceData.Data)
	return svcVoiceData
}