-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathclient_rcb_test.go
60 lines (54 loc) · 1.34 KB
/
client_rcb_test.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
package client_rcb
import (
"github.com/wendy512/iec61850"
"github.com/wendy512/iec61850/test"
"log"
"testing"
)
func TestRBC(t *testing.T) {
client := test.CreateClient(t)
defer test.CloseClient(client)
objectRef := "simpleIOGenericIO/GGIO1.SPCSO1.stVal"
value, err := client.Read(objectRef, iec61850.ST)
if err != nil {
t.Fatal(err)
}
log.Printf("%s -> %v\n", objectRef, value)
rbcRef := "simpleIOGenericIO/LLN0.RP.EventsRCB01"
rcbValue, err := client.GetRCBValues(rbcRef)
if err != nil {
t.Fatal(err)
}
log.Printf("write before %s -> %#v\n", rbcRef, rcbValue)
err = client.SetRCBValues(rbcRef, iec61850.ClientReportControlBlock{
Ena: true,
IntgPd: 500,
OptFlds: iec61850.OptFlds{
SequenceNumber: true,
TimeOfEntry: true,
ReasonForInclusion: true,
DataSetName: true,
DataReference: true,
BufferOverflow: true,
EntryID: true,
ConfigRevision: true,
},
TrgOps: iec61850.TrgOps{
DataChange: true,
QualityChange: true,
DataUpdate: true,
TriggeredPeriodically: true,
Gi: true,
Transient: false,
},
})
if err != nil {
t.Fatal(err)
}
rcbValue, err = client.GetRCBValues(rbcRef)
if err != nil {
t.Error(err)
return
}
log.Printf("write after %s -> %#v\n", rbcRef, rcbValue)
}