-
Notifications
You must be signed in to change notification settings - Fork 13
/
nodemanagement_destinationlist.go
50 lines (39 loc) · 1.75 KB
/
nodemanagement_destinationlist.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
package spine
import (
"errors"
"fmt"
"github.com/enbility/eebus-go/spine/model"
)
func (r *NodeManagementImpl) RequestDestinationListData(remoteDeviceAddress *model.AddressDeviceType, sender Sender) (*model.MsgCounterType, *ErrorType) {
return nil, NewErrorTypeFromString("Not implemented")
}
func (r *NodeManagementImpl) processReadDestinationListData(featureRemote *FeatureRemoteImpl, requestHeader *model.HeaderType) error {
data := []model.NodeManagementDestinationDataType{
r.Device().DestinationData(),
}
// add other remote devices here
cmd := model.CmdType{
NodeManagementDestinationListData: &model.NodeManagementDestinationListDataType{
NodeManagementDestinationData: data,
},
}
return featureRemote.Sender().Reply(requestHeader, r.Address(), cmd)
}
func (r *NodeManagementImpl) processReplyDestinationListData(message *Message, data model.NodeManagementDestinationListDataType) error {
return errors.New("Not implemented")
}
func (r *NodeManagementImpl) handleMsgDestinationListData(message *Message, data *model.NodeManagementDestinationListDataType) error {
switch message.CmdClassifier {
case model.CmdClassifierTypeRead:
return r.processReadDestinationListData(message.FeatureRemote, message.RequestHeader)
case model.CmdClassifierTypeReply:
if err := r.pendingRequests.Remove(message.DeviceRemote.ski, *message.RequestHeader.MsgCounterReference); err != nil {
return errors.New(err.String())
}
return r.processReplyDestinationListData(message, *data)
case model.CmdClassifierTypeNotify:
return r.processReplyDestinationListData(message, *data)
default:
return fmt.Errorf("nodemanagement.handleMsgDestinationListData: NodeManagementDestinationListDataType CmdClassifierType not implemented: %s", message.CmdClassifier)
}
}