-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from buhuang28/dev
add GetLogicalDeviceList function to browse the data model of an unknown device.
- Loading branch information
Showing
7 changed files
with
235 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package iec61850 | ||
|
||
import "C" | ||
import sc "golang.org/x/text/encoding/simplifiedchinese" | ||
|
||
func C2GoStr(str *C.char) string { | ||
utf8str, _ := sc.GB18030.NewDecoder().String(C.GoString(str)) | ||
return utf8str | ||
} | ||
|
||
func Go2CStr(str string) *C.char { | ||
gbstr, _ := sc.GB18030.NewEncoder().String(str) | ||
return C.CString(gbstr) | ||
} | ||
|
||
func C2GoBool(i C.int) bool { | ||
if i == 1 { | ||
return true | ||
} | ||
return false | ||
} | ||
|
||
func Go2CBool(b bool) C.int { | ||
if b { | ||
return 1 | ||
} | ||
return 0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package iec61850 | ||
|
||
type DataModel struct { | ||
LDs []LD | ||
} | ||
|
||
type LD struct { | ||
Data string | ||
LNs []LN | ||
} | ||
|
||
type LN struct { | ||
Data string | ||
DOs []DO | ||
DSs []DS | ||
URReports []URReport | ||
BRReports []BRReport | ||
} | ||
|
||
type URReport struct { | ||
Data string | ||
} | ||
|
||
type BRReport struct { | ||
Data string | ||
} | ||
|
||
type DS struct { | ||
Data string | ||
DSRefs []DSRef | ||
} | ||
|
||
type DSRef struct { | ||
Data string | ||
} | ||
|
||
type DO struct { | ||
Data string | ||
DAs []DA | ||
} | ||
|
||
type DA struct { | ||
Data string | ||
DAs []DA | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,9 @@ | ||
github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= | ||
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= | ||
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= | ||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= | ||
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= | ||
github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= | ||
github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= | ||
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= | ||
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters