Documentation ¶
Overview ¶
wrap7 project wrap7.go
wrap7 project wrap7.go
wrap7 project wrap7.go
Index ¶
- Constants
- Variables
- func ABRead(client C.S7Object, Start, Amount int) (int, []byte)
- func ABWrite(client C.S7Object, Start, Amount int, gobuffer *[]byte) (int, []byte)
- func BfDBInfo(MyClient S7Object, maxdbnr int)
- func BfDBList(MyClient S7Object, startDB, endDB int) []int
- func BfDBgetSize(MyClient S7Object, dbnr int) int
- func Bit2Pos(n int) (pos uint)
- func ByteDBuffer(i *uint8) []byte
- func ByteDBuffer2(j uint8) []byte
- func ByteDBuffer3(j uint8) *[]byte
- func CTRead(client C.S7Object, Start, Amount int) (int, []byte)
- func CTWrite(client C.S7Object, Start, Amount int, gobuffer *[]byte) (int, []byte)
- func CharDBuffer(c *rune) []byte
- func CharDBuffer2(z rune) []byte
- func CharDBuffer3(z rune) *[]byte
- func ClearBit(n int, pos uint) int
- func CliConnect(client S7Object, ip net.IP, rack uint8, slot uint8)
- func CliDestroy(client *S7Object)
- func CliDisconnect(client S7Object)
- func CliDisconnectAndDestroy(client S7Object)
- func DBRead(client C.S7Object, DBNumber, Start, Amount int) (int, []byte)
- func DBWrite(client C.S7Object, DBNumber, Start, Amount int, gobuffer *[]byte) (int, []byte)
- func DBufferByte(b *[]byte) uint8
- func DBufferByte2(b []byte) uint8
- func DBufferByte3(b byte) uint8
- func DBufferChar(b *[]byte) rune
- func DBufferChar2(b []byte) rune
- func DBufferChar3(b byte) rune
- func DBufferDInt(b *[]byte) int32
- func DBufferDInt2(b []byte) int32
- func DBufferDWord(b *[]byte) uint32
- func DBufferDWord2(b []byte) uint32
- func DBufferDateNTime(b *[]byte) time.Time
- func DBufferDateNTime2(b []byte) time.Time
- func DBufferInt(b *[]byte) int16
- func DBufferInt2(b []byte) int16
- func DBufferReal(b *[]byte) float32
- func DBufferReal2(b []byte) float32
- func DBufferString(b *[]byte) string
- func DBufferString2(b []byte) string
- func DBufferWord(b *[]byte) uint16
- func DBufferWord2(b []byte) uint16
- func DIntDBuffer(i *int32) []byte
- func DIntDBuffer2(j int32) []byte
- func DIntDBuffer3(j int32) *[]byte
- func DWordDBuffer(i *uint32) []byte
- func DWordDBuffer2(j uint32) []byte
- func DWordDBuffer3(j uint32) *[]byte
- func DateNTimeDBuffer(t *time.Time, strictZeroTime bool) (b []byte)
- func DateNTimeDBuffer2(d time.Time, strictZeroTime bool) []byte
- func DateNTimeDBuffer3(d time.Time, strictZeroTime bool) *[]byte
- func Disconnect(client S7Object)
- func EBRead(client C.S7Object, Start, Amount int) (int, []byte)
- func EBWrite(client C.S7Object, Start, Amount int, gobuffer *[]byte) (int, []byte)
- func HasBit(n int, pos uint) bool
- func IntDBuffer(i *int16) []byte
- func IntDBuffer2(j int16) []byte
- func IntDBuffer3(j int16) *[]byte
- func MBRead(client C.S7Object, Start, Amount int) (int, []byte)
- func MBWrite(client C.S7Object, Start, Amount int, gobuffer *[]byte) (int, []byte)
- func MeasureSPSTypeLength(s DataTypeType) int8
- func MultiRead(client C.S7Object, items []MultiReadWriteItem) (int, [][]byte)
- func MultiWrite(client C.S7Object, items []MultiReadWriteItem, buffers *[][]byte) (int, [][]byte)
- func ParseDate(ds string) (time.Time, error)
- func ParseDateTime(dts string) (time.Time, error)
- func ParseHexForByteWordAndDWord(hs string) (int, error)
- func ParseTime(dt string) (time.Time, error)
- func Pos2Bit(pos uint) (n int)
- func ReadArea(client C.S7Object, Area, DBNumber, Start, Amount, WordLen int) (int, []byte)
- func RealDBuffer(r *float32) []byte
- func RealDBuffer2(f float32) []byte
- func RealDBuffer3(f float32) *[]byte
- func RegisterEventCallBack(server *S7Object)
- func SetBit(n int, pos uint) int
- func SrvDestroy(server *S7Object)
- func SrvErrorText(errorCode int, spsServerText *rune, eventCallBackLength int)
- func SrvLockArea(server *S7Object, area int, index uint16)
- func SrvRegisterArea(server *S7Object, area int, index uint16, buffer []byte, length int)
- func SrvStart(server *S7Object) int
- func SrvStop(server *S7Object)
- func SrvUnlockArea(server *S7Object, area int, index uint16)
- func SrvUnregisterArea(server *S7Object, area int, index uint16)
- func StringDBuffer(s *string) []byte
- func StringDBuffer2(ß string) []byte
- func StringDBuffer3(ß string) *[]byte
- func TMRead(client C.S7Object, Start, Amount int) (int, []byte)
- func TMWrite(client C.S7Object, Start, Amount int, gobuffer *[]byte) (int, []byte)
- func WordDBuffer(i *uint16) []byte
- func WordDBuffer2(j uint16) []byte
- func WordDBuffer3(j uint16) *[]byte
- func WriteArea(client C.S7Object, Area, DBNumber, Start, Amount, WordLen int, ...) (int, []byte)
- type ConditionType
- type DataTypeType
- type MultiReadWriteItem
- type S7Object
- type TS7BlockInfo
- type TS7BlocksList
- type TS7CpInfo
- type TS7OrderCode
- type TSCpuInfo
Constants ¶
const ( PINGER_COUNT = 10 // Die Anzahl an Pings, die der Pinger zur Auswertung heranzieht. Pinger-Counts kosten richtig viel Zeit. Leider ist ein Ping alleine viel zu ungenau. PINGER_TIMEOUT = "1000ms" // Sobald der Pinger innerhalb dieser Zeitspanne keinen Erfolg hat, liefert er 0ms Pingzeit und 100% Paketloss zur?ck. PINGER_CRITICAL_LOSS_PERCENT = 100 )
const ( BlockTypeOB = 0x38 BlockTypeDB = 0x41 BlockTypeSDB = 0x42 BlockTypeFC = 0x43 BlockTypeSFC = 0x44 BlockTypeFB = 0x45 BlockTypeSFB = 0x46 )
const MAXPDULENGTH int = 960
Diese Konstante gibt es doppelt. Sie muß auch im C-Code angepaßt werden!
const MULTIREADWRITE_BUFFERS = 10 // Wievele Buffers und Items MultiRead und MultiWrite anlegen soll.
Variables ¶
var ( S7AreaDB = (int)(C.S7AreaDB) S7AreaMK = (int)(C.S7AreaMK) S7AreaPE = (int)(C.S7AreaPE) S7AreaPA = (int)(C.S7AreaPA) S7AreaTM = (int)(C.S7AreaTM) S7AreaCT = (int)(C.S7AreaCT) S7WLBit = (int)(C.S7WLBit) S7WLByte = (int)(C.S7WLByte) S7WLWord = (int)(C.S7WLWord) S7WLDWord = (int)(C.S7WLDWord) S7WLReal = (int)(C.S7WLReal) S7WLCounter = (int)(C.S7WLCounter) S7WLTimer = (int)(C.S7WLTimer) )
var ( SrvAreaPE = (int)(C.srvAreaPE) SrvAreaPA = (int)(C.srvAreaPA) SrvAreaMK = (int)(C.srvAreaMK) SrvAreaCT = (int)(C.srvAreaCT) SrvAreaTM = (int)(C.srvAreaTM) SrvAreaDB = (int)(C.srvAreaDB) )
var EventCallBackLength = (int)(C.EventCallBackLength)
Functions ¶
func BfDBgetSize ¶
func ByteDBuffer ¶
func ByteDBuffer2 ¶
func ByteDBuffer3 ¶
func CharDBuffer ¶
func CharDBuffer2 ¶
func CharDBuffer3 ¶
func CliConnect ¶
CliConnect connects to SPS-client
func CliDestroy ¶
func CliDestroy(client *S7Object)
func CliDisconnect ¶
func CliDisconnect(client S7Object)
CliDisconnect disconnects SPS-client from SPS
func CliDisconnectAndDestroy ¶
func CliDisconnectAndDestroy(client S7Object)
func DBufferByte ¶
func DBufferByte2 ¶
func DBufferByte3 ¶
func DBufferChar ¶
func DBufferChar2 ¶
func DBufferChar3 ¶
func DBufferDInt ¶
func DBufferDInt2 ¶
func DBufferDWord ¶
func DBufferDWord2 ¶
func DBufferDateNTime ¶
DBufferDateNTime wird für die drei Datentypen Date_and_Time, Date und Time benötigt
func DBufferDateNTime2 ¶
func DBufferInt ¶
func DBufferInt2 ¶
func DBufferReal ¶
func DBufferReal2 ¶
func DBufferString ¶
func DBufferString2 ¶
func DBufferWord ¶
func DBufferWord2 ¶
func DIntDBuffer ¶
func DIntDBuffer2 ¶
func DIntDBuffer3 ¶
func DWordDBuffer ¶
func DWordDBuffer2 ¶
func DWordDBuffer3 ¶
func DateNTimeDBuffer ¶
DateNTimeDBuffer wird für die drei Datentypen Date_and_Time, Date und Time benötigt
func Disconnect ¶
func Disconnect(client S7Object)
FIXME: Remove me sometimes Disconnect is a wrapper for CliDisconnect for compatibility purpose, has to be removed in a later version or wrap7
func IntDBuffer ¶
func IntDBuffer2 ¶
func IntDBuffer3 ¶
func MeasureSPSTypeLength ¶
func MeasureSPSTypeLength(s DataTypeType) int8
Gets Wordlength of S7-Type
func MeasureSPSTypeLength(s string) int8 { switch strings.ToLower(s) { case "int": return 2 case "dint": return 4 case "real": return 4 case "date_and_time": return 8 case "date": // Nicht verifiziert return 2 case "time": // Nicht verifiziert return 4 case "bool": return 1 case "char": return 1 case "byte": return 1 case "word": // Nicht verifiziert return 2 case "dword": // Nicht verifiziert return 4 default: // Nur im Fehlerfall return -1 } }
func MultiRead ¶
func MultiRead(client C.S7Object, items []MultiReadWriteItem) (int, [][]byte)
MultiRead liest ein Array von Werten aus der SPS
func MultiWrite ¶
MultiWrite schreibt ein Array von Werten in die SPS. Auf den ersten Blick ist ein Rücklesen der Werte in MultiWrite nun ein überflüssiger Overhead. Machen wir dies hier aber nicht, müßte in Fällen, wo mit dem veränderten Speicher weitergearbeitet werden soll, ein weiteres MultiRead folgen. Dies können wir hier einsparen, wenn wir den veränderten Speicher hier zurückgeben. Wir bleiben somit auch synchron zur MultiRead-Funktion
func ParseDateTime ¶
ParseDateTime kann der Funktion DateNTimeDBuffer vorgeschaltet werden
func RealDBuffer ¶
func RealDBuffer2 ¶
func RealDBuffer3 ¶
func RegisterEventCallBack ¶
func RegisterEventCallBack(server *S7Object)
func SrvDestroy ¶
func SrvDestroy(server *S7Object)
func SrvErrorText ¶
func SrvLockArea ¶
func SrvRegisterArea ¶
func SrvUnlockArea ¶
func SrvUnregisterArea ¶
func StringDBuffer ¶
func StringDBuffer2 ¶
func StringDBuffer3 ¶
func WordDBuffer ¶
func WordDBuffer2 ¶
func WordDBuffer3 ¶
Types ¶
type ConditionType ¶
type ConditionType string
const ( CONDITION_RUNNING ConditionType = "running" CONDITION_STOPPED ConditionType = "stopped" CONDITION_UNKNOWN ConditionType = "unknown" )
func GetPlcStatus ¶
func GetPlcStatus(client C.S7Object) (int, int8, ConditionType)
type DataTypeType ¶
type DataTypeType string
const ( DTTint DataTypeType = "int" DTTdint DataTypeType = "dint" DTTreal DataTypeType = "real" DTTdatetime DataTypeType = "date_and_time" DTTdate DataTypeType = "date" DTTtime DataTypeType = "time" DTTbool DataTypeType = "bool" DTTbyte DataTypeType = "byte" DTTchar DataTypeType = "char" DTTword DataTypeType = "word" DTTdword DataTypeType = "dword" )
type MultiReadWriteItem ¶
type MultiReadWriteItem struct {
Area, WordLen, DBNumber, Start, Amount int
}
type S7Object ¶
func CliConditionalCreateAndConnect ¶
CliConditionalCreateAndConnect creates a SPS-client after successfull ping and connects to SPS
func CliCreateAndConnect ¶
CliCreateAndConnect creates a SPS-client and connect to SPS
func CreateAndConnect ¶
FIXME: Remove me sometimes CreateAndConnect is a wrapper for CliDisconnect for compatibility purpose, has to be removed in a later version or wrap7
type TS7BlockInfo ¶
type TS7BlockInfo struct { BlkType int // Block Type (OB, DB) BlkNumber int // Block number BlkLang int // Block Language BlkFlags int // Block flags MC7Size int // The real size in bytes LoadSize int // Load memory size LocalData int // Local data SBBLength int // SBB Length CheckSum int // Checksum Version int // Block version // Chars info CodeDate string // Code date IntfDate string // Interface date Author string // Author Family string // Family Header string // Header }
func GetAgBlockInfo ¶
func GetAgBlockInfo(client C.S7Object, blockType, blockNum int) (int, TS7BlockInfo)
type TS7BlocksList ¶
type TS7BlocksList struct {
OBCount, FBCount, FCCount, SFBCount, SFCCount, DBCount, SDBCount int
}
func ListBlocks ¶
func ListBlocks(client C.S7Object) (int, TS7BlocksList)
type TS7CpInfo ¶
type TS7CpInfo struct {
MaxPduLength, MaxConnections, MaxMpiRate, MaxBusRate int // MaxPduLengt zu MaxPduLength korrigiert
}
type TS7OrderCode ¶
func GetOrderCode ¶
func GetOrderCode(client C.S7Object) (int, TS7OrderCode)