-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patheebus.go
32 lines (26 loc) · 971 Bytes
/
eebus.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
package go_eebus
import (
"github.com/LMF-DHBW/go-eebus/resources"
"github.com/LMF-DHBW/go-eebus/spine"
)
type EebusNode struct {
isGateway bool
SpineNode *spine.SpineNode
DeviceStructure *resources.DeviceModel
Update Updater
}
type Updater func(resources.DatagramType, spine.SpineConnection)
func NewEebusNode(hostname string, isGateway bool, certName string, devId string, brand string, devType string) *EebusNode {
deviceModel := &resources.DeviceModel{}
newEebusNode := &EebusNode{isGateway, nil, deviceModel, nil}
newEebusNode.SpineNode = spine.NewSpineNode(hostname, isGateway, deviceModel, newEebusNode.SubscriptionNofity, certName, devId, brand, devType)
return newEebusNode
}
func (eebusNode *EebusNode) SubscriptionNofity(datagram resources.DatagramType, conn spine.SpineConnection) {
if eebusNode.Update != nil {
eebusNode.Update(datagram, conn)
}
}
func (eebusNode *EebusNode) Start() {
eebusNode.SpineNode.Start()
}