robinson / gos7

Implementation of Siemens S7 protocol in golang
BSD 3-Clause "New" or "Revised" License
314 stars 121 forks source link

GetAgBlockInfo return "Function not available" #27

Open ThinkontrolSY opened 4 years ago

ThinkontrolSY commented 4 years ago

Test CPU: SIEMENS S7-1211 Test Block: DB1

func TestGetBlockInfo(t *testing.T) {
    handler := gos7.NewTCPClientHandler("192.168.1.3", 0, 1)
    handler.Timeout = 5 * time.Second
    handler.IdleTimeout = 5 * time.Second
    defer handler.Close()
    if err := handler.Connect(); err == nil {
        client := gos7.NewClient(handler)
        info, err := client.GetAgBlockInfo(65, 1)
        t.Log(err)
        t.Logf("BlkType: %v", info.BlkType)
        t.Logf("BlkNumber: %v", info.BlkNumber)
        t.Logf("BlkLang: %v", info.BlkLang)
        t.Logf("BlkFlags: %v", info.BlkFlags)
        t.Logf("MC7Size: %v", info.MC7Size)
        t.Logf("LoadSize: %v", info.LoadSize)
        t.Logf("LocalData: %v", info.LocalData)
        t.Logf("SBBLength: %v", info.SBBLength)
        t.Logf("CheckSum: %v", info.CheckSum)
        t.Logf("Version: %v", info.Version)
        t.Logf("CodeDate: %v", info.CodeDate)
        t.Logf("IntfDate: %v", info.IntfDate)
        t.Logf("Author: %v", info.Author)
        t.Logf("Family: %v", info.Family)
        t.Logf("Header: %v", info.Header)
    } else {
        t.Fatal(err)
    }
}

return

=== RUN   TestGetBlockInfo
--- PASS: TestGetBlockInfo (0.09s)
    plc_test.go:35: CPU : Function not available
    plc_test.go:36: BlkType: 0
    plc_test.go:37: BlkNumber: 0
    plc_test.go:38: BlkLang: 0
    plc_test.go:39: BlkFlags: 0
    plc_test.go:40: MC7Size: 0
    plc_test.go:41: LoadSize: 0
    plc_test.go:42: LocalData: 0
    plc_test.go:43: SBBLength: 0
    plc_test.go:44: CheckSum: 0
    plc_test.go:45: Version: 0
    plc_test.go:46: CodeDate: 
    plc_test.go:47: IntfDate: 
    plc_test.go:48: Author: 
    plc_test.go:49: Family: 
    plc_test.go:50: Header: 
PASS
Etran-H commented 4 years ago

PLC: s7-1511 same error

        bi, err := client.GetAgBlockInfo(blockFC, 1)
        if err != nil {
            fmt.Println(err)
        }

out CPU : Function not available