-
Notifications
You must be signed in to change notification settings - Fork 1
/
BaseCommunicationChannel.go
59 lines (44 loc) · 1.31 KB
/
BaseCommunicationChannel.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
package api
type BaseCommunicationChannel struct {
factory Factory
environment Environment
thingManager ThingManager
config ChannelConfiguration
protocols map[string] ProtocolHandler
container Container
}
func NewBaseCommunicationChannel() (BaseCommunicationChannel) {
c := new(BaseCommunicationChannel)
c.protocols = make(map[string] ProtocolHandler)
return *c
}
func (cc BaseCommunicationChannel) GetProtocols() map[string] ProtocolHandler {
return cc.protocols
}
func (cc BaseCommunicationChannel) GetProtocol(p string) (ProtocolHandler) {
return cc.protocols[p]
}
func (cc BaseCommunicationChannel) GetConfiguration() ChannelConfiguration {
return cc.config
}
func (cc *BaseCommunicationChannel) SetChannelConfiguration(c ChannelConfiguration) {
cc.config = c
}
func (cc *BaseCommunicationChannel) SetThingManager(t ThingManager) {
cc.thingManager = t
}
func (cc *BaseCommunicationChannel) SetFactory(f Factory) {
cc.factory = f
}
func (cc *BaseCommunicationChannel) SetEnvironment(e Environment) {
cc.environment = e
}
func (cc *BaseCommunicationChannel) SetContainer(c Container) {
cc.container = c
}
func (cc *BaseCommunicationChannel) AddProtocol(h ProtocolHandler) {
cc.protocols[h.GetName()] = h
}
func (s BaseCommunicationChannel) IsEnabled() bool {
return s.config.Enabled
}