forked from hootrhino/rulex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
iec104_client_test.go
67 lines (53 loc) · 1.29 KB
/
iec104_client_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
61
62
63
64
65
66
67
package test
import (
"fmt"
"testing"
"time"
"github.com/thinkgos/go-iecp5/asdu"
"github.com/thinkgos/go-iecp5/cs104"
)
type myClient struct{}
func Test_104_client(t *testing.T) {
var err error
option := cs104.NewOption()
if err = option.AddRemoteServer("127.0.0.1:2404"); err != nil {
panic(err)
}
mycli := &myClient{}
client := cs104.NewClient(mycli, option)
client.LogMode(true)
client.SetOnConnectHandler(func(c *cs104.Client) {
c.SendStartDt() // 发送startDt激活指令
})
err = client.Start()
if err != nil {
panic(fmt.Errorf("Failed to connect. error:%v\n", err))
}
for {
time.Sleep(time.Second * 100)
}
}
func (myClient) InterrogationHandler(asdu.Connect, *asdu.ASDU) error {
return nil
}
func (myClient) CounterInterrogationHandler(asdu.Connect, *asdu.ASDU) error {
return nil
}
func (myClient) ReadHandler(asdu.Connect, *asdu.ASDU) error {
return nil
}
func (myClient) TestCommandHandler(asdu.Connect, *asdu.ASDU) error {
return nil
}
func (myClient) ClockSyncHandler(asdu.Connect, *asdu.ASDU) error {
return nil
}
func (myClient) ResetProcessHandler(asdu.Connect, *asdu.ASDU) error {
return nil
}
func (myClient) DelayAcquisitionHandler(asdu.Connect, *asdu.ASDU) error {
return nil
}
func (myClient) ASDUHandler(asdu.Connect, *asdu.ASDU) error {
return nil
}