-
Notifications
You must be signed in to change notification settings - Fork 41
/
lecture_hall.go
59 lines (51 loc) · 1.21 KB
/
lecture_hall.go
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package model
import "gorm.io/gorm"
type LectureHall struct {
gorm.Model
Name string `gorm:"not null"` //as in smp (e.g. room_00_13_009A)
FullName string `gorm:"not null"` //e.g. '5613.EG.009A (00.13.009A, Seminarraum), Boltzmannstr. 3(5613), 85748 Garching b. München'
CombIP string
PresIP string
CamIP string
CameraIP string // ip of the actual camera (not smp)
CameraType CameraType `gorm:"not null; default:1"`
Streams []Stream
CameraPresets []CameraPreset
RoomID int // used by TUMOnline
PwrCtrlIp string // power control api for red live light
LiveLightIndex int // id of power outlet for live light
ExternalURL string
}
type CameraType uint
const (
Axis CameraType = iota + 1
Panasonic
)
func (l LectureHall) NumSources() int {
num := 0
if l.CombIP != "" {
num++
}
if l.PresIP != "" {
num++
}
if l.CamIP != "" {
num++
}
return num
}
type LectureHallDTO struct {
ID uint
Name string
ExternalURL string
}
func (l *LectureHall) ToDTO() *LectureHallDTO {
if l == nil {
return nil
}
return &LectureHallDTO{
ID: l.ID,
Name: l.Name,
ExternalURL: l.ExternalURL,
}
}