-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.go
67 lines (50 loc) · 1.28 KB
/
types.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
60
61
62
63
64
65
66
67
package service
import (
"fmt"
"reflect"
"github.com/valyala/fasthttp"
"github.com/zwcway/fasthttp-upnp/scpd"
"github.com/zwcway/fasthttp-upnp/soap"
)
const (
DeviceType_MediaServer = "MediaServer"
DeviceType_MediaRenderer = "MediaRenderer"
ServiceName_AVTransport = "AVTransport"
ServiceName_ConnectionManager = "ConnectionManager"
ServiceName_RenderingControl = "RenderingControl"
)
const ResponseContentTypeXML = `text/xml; charset="utf-8"`
type ActionHandler func(input any, output any, ctx *fasthttp.RequestCtx, uuid string) error
type Argument struct {
Name string
Direction string
RelatedStateVar *scpd.Variable
}
type soapArg struct {
name string
rv reflect.Value
sv *scpd.Variable
}
type Action struct {
Handler ActionHandler
ArgIn any
ArgOut any
Name string
stateVariable []*scpd.Variable
inSoap []soapArg
outSoap []soapArg
}
func (a *Action) SetStateVariables(sv []*scpd.Variable) *Action {
a.stateVariable = make([]*scpd.Variable, len(sv))
for i := range sv {
a.stateVariable[i] = sv[i]
}
return a
}
func ServiceNS(service string, ver int) string {
return fmt.Sprintf("urn:%s:service:%s:%d", soap.AuthName, service, ver)
}
type ActionArgumentIn interface {
}
type ActionArgumentOut interface {
}