Documentation
¶
Index ¶
- Variables
- func CtxGenerator() typedef.Ulint
- func GetLanDevices(scanTimeout time.Duration) (map[string]*Device, error)
- func ReadByte(reader io.Reader, target interface{})
- func ReadByteBigEndian(reader io.Reader, target interface{})
- func WriteByte(writer io.Writer, target interface{})
- type CommonPacketFormat
- type CommonPacketFormatItem
- type Config
- type Device
- func (d *Device) Connect(config *Config) error
- func (d *Device) Disconnect()
- func (d *Device) ListIdentity() (*ListIdentity, error)
- func (d *Device) ListInterface() (*ListInterface, error)
- func (d *Device) ListServices() (*ListServices, error)
- func (d *Device) SendRRData(cpf *CommonPacketFormat, timeout typedef.Uint) (*SendDataSpecificData, error)
- func (d *Device) SendUnitData(cpf *CommonPacketFormat, timeout typedef.Uint) (*SendDataSpecificData, error)
- func (d *Device) String() string
- type EIPCommand
- type EIPTCP
- func (e *EIPTCP) Close()
- func (e *EIPTCP) Connect() error
- func (e *EIPTCP) ListIdentity() (*ListIdentity, error)
- func (e *EIPTCP) ListIdentityDecode(encapsulationPacket *EncapsulationPacket) *ListIdentity
- func (e *EIPTCP) ListInterface() (*ListInterface, error)
- func (e *EIPTCP) ListInterfaceDecode(encapsulationPacket *EncapsulationPacket) *ListInterface
- func (e *EIPTCP) ListServices() (*ListServices, error)
- func (e *EIPTCP) ListServicesDecode(encapsulationPacket *EncapsulationPacket) *ListServices
- func (e *EIPTCP) RegisterSession() error
- func (e *EIPTCP) RegisterSessionDecode(encapsulationPacket *EncapsulationPacket)
- func (e *EIPTCP) SendRRData(cpf *CommonPacketFormat, timeout typedef.Uint) (*SendDataSpecificData, error)
- func (e *EIPTCP) SendRRDataDecode(encapsulationPacket *EncapsulationPacket) *SendDataSpecificData
- func (e *EIPTCP) SendUnitData(cpf *CommonPacketFormat, timeout typedef.Uint) (*SendDataSpecificData, error)
- func (e *EIPTCP) SendUnitDataDecode(encapsulationPacket *EncapsulationPacket) *SendDataSpecificData
- func (e *EIPTCP) UnRegisterSession()
- func (e *EIPTCP) UnRegisterSessionDecode(encapsulationPacket *EncapsulationPacket)
- type EIPUDP
- func (e *EIPUDP) Close()
- func (e *EIPUDP) Connect() error
- func (e *EIPUDP) ListIdentity()
- func (e *EIPUDP) ListIdentityDecode(encapsulationPacket *EncapsulationPacket) *ListIdentity
- func (e *EIPUDP) ListInterface()
- func (e *EIPUDP) ListInterfaceDecode(encapsulationPacket *EncapsulationPacket) *ListInterface
- func (e *EIPUDP) ListServices()
- func (e *EIPUDP) ListServicesDecode(encapsulationPacket *EncapsulationPacket) *ListServices
- type EncapsulationHeader
- type EncapsulationPacket
- func NewListIdentity(context typedef.Ulint) *EncapsulationPacket
- func NewListInterface(context typedef.Ulint) *EncapsulationPacket
- func NewListServices(context typedef.Ulint) *EncapsulationPacket
- func NewNOP(data []byte) *EncapsulationPacket
- func NewRegisterSession(context typedef.Ulint) *EncapsulationPacket
- func NewSendRRData(session typedef.Udint, context typedef.Ulint, cpf *CommonPacketFormat, ...) *EncapsulationPacket
- func NewSendUnitData(session typedef.Udint, context typedef.Ulint, cpf *CommonPacketFormat, ...) *EncapsulationPacket
- func NewUnRegisterSession(session typedef.Udint, context typedef.Ulint) *EncapsulationPacket
- type FragmentedReadResponse
- type ItemID
- type ListIdentity
- type ListIdentityItem
- type ListInterface
- type ListInterfaceItem
- type ListServices
- type ListServicesItem
- type MessageRouterRequest
- type MessageRouterResponse
- type SendDataSpecificData
Constants ¶
This section is empty.
Variables ¶
View Source
var EIPCommandMap map[EIPCommand]bool
View Source
var EIPError map[typedef.Udint]string
Functions ¶
func CtxGenerator ¶
func ReadByteBigEndian ¶
Types ¶
type CommonPacketFormat ¶
type CommonPacketFormat struct {
ItemCount typedef.Uint
Items []CommonPacketFormatItem
}
func (*CommonPacketFormat) Decode ¶
func (c *CommonPacketFormat) Decode(dataReader *bytes.Reader)
func (*CommonPacketFormat) Encode ¶
func (c *CommonPacketFormat) Encode() []byte
func (*CommonPacketFormat) New ¶
func (c *CommonPacketFormat) New(items []CommonPacketFormatItem)
type CommonPacketFormatItem ¶
func (*CommonPacketFormatItem) Decode ¶
func (i *CommonPacketFormatItem) Decode(dataReader *bytes.Reader)
func (*CommonPacketFormatItem) Encode ¶
func (i *CommonPacketFormatItem) Encode() []byte
func (*CommonPacketFormatItem) New ¶
func (i *CommonPacketFormatItem) New(id ItemID, data []byte)
type Config ¶
type Config struct {
TCPPort uint16
UDPPort uint16
TCPTimeout time.Duration
TCPReconnectionInterval time.Duration
AutoSession bool
}
func DefaultConfig ¶
func DefaultConfig() *Config
type Device ¶
type Device struct {
IP net.IP
VendorID typedef.Uint
DeviceType typedef.Uint
ProductCode typedef.Uint
Major typedef.Usint
Minor typedef.Usint
Status typedef.Word
SerialNumber typedef.Udint
ProductName string
// contains filtered or unexported fields
}
func (*Device) Disconnect ¶
func (d *Device) Disconnect()
func (*Device) ListIdentity ¶
func (d *Device) ListIdentity() (*ListIdentity, error)
func (*Device) ListInterface ¶
func (d *Device) ListInterface() (*ListInterface, error)
func (*Device) ListServices ¶
func (d *Device) ListServices() (*ListServices, error)
func (*Device) SendRRData ¶
func (d *Device) SendRRData(cpf *CommonPacketFormat, timeout typedef.Uint) (*SendDataSpecificData, error)
func (*Device) SendUnitData ¶
func (d *Device) SendUnitData(cpf *CommonPacketFormat, timeout typedef.Uint) (*SendDataSpecificData, error)
type EIPCommand ¶
const ( EIPCommandNOP EIPCommand = 0x00 EIPCommandListServices EIPCommand = 0x04 EIPCommandListIdentity EIPCommand = 0x63 EIPCommandListInterfaces EIPCommand = 0x64 EIPCommandRegisterSession EIPCommand = 0x65 EIPCommandUnRegisterSession EIPCommand = 0x66 EIPCommandSendRRData EIPCommand = 0x6F EIPCommandSendUnitData EIPCommand = 0x70 )
type EIPTCP ¶
type EIPTCP struct {
Connected func()
Disconnected func(error)
Reconnecting func()
// contains filtered or unexported fields
}
func (*EIPTCP) ListIdentity ¶
func (e *EIPTCP) ListIdentity() (*ListIdentity, error)
func (*EIPTCP) ListIdentityDecode ¶
func (e *EIPTCP) ListIdentityDecode(encapsulationPacket *EncapsulationPacket) *ListIdentity
func (*EIPTCP) ListInterface ¶
func (e *EIPTCP) ListInterface() (*ListInterface, error)
func (*EIPTCP) ListInterfaceDecode ¶
func (e *EIPTCP) ListInterfaceDecode(encapsulationPacket *EncapsulationPacket) *ListInterface
func (*EIPTCP) ListServices ¶
func (e *EIPTCP) ListServices() (*ListServices, error)
func (*EIPTCP) ListServicesDecode ¶
func (e *EIPTCP) ListServicesDecode(encapsulationPacket *EncapsulationPacket) *ListServices
func (*EIPTCP) RegisterSession ¶
func (*EIPTCP) RegisterSessionDecode ¶
func (e *EIPTCP) RegisterSessionDecode(encapsulationPacket *EncapsulationPacket)
func (*EIPTCP) SendRRData ¶
func (e *EIPTCP) SendRRData(cpf *CommonPacketFormat, timeout typedef.Uint) (*SendDataSpecificData, error)
func (*EIPTCP) SendRRDataDecode ¶
func (e *EIPTCP) SendRRDataDecode(encapsulationPacket *EncapsulationPacket) *SendDataSpecificData
func (*EIPTCP) SendUnitData ¶
func (e *EIPTCP) SendUnitData(cpf *CommonPacketFormat, timeout typedef.Uint) (*SendDataSpecificData, error)
func (*EIPTCP) SendUnitDataDecode ¶
func (e *EIPTCP) SendUnitDataDecode(encapsulationPacket *EncapsulationPacket) *SendDataSpecificData
func (*EIPTCP) UnRegisterSession ¶
func (e *EIPTCP) UnRegisterSession()
func (*EIPTCP) UnRegisterSessionDecode ¶
func (e *EIPTCP) UnRegisterSessionDecode(encapsulationPacket *EncapsulationPacket)
type EIPUDP ¶
type EIPUDP struct {
Devices map[string]*Device
InterfaceHandle func(string, *ListInterface)
ServicesHandle func(string, *ListServices)
// contains filtered or unexported fields
}
func NewUDPWithAutoScan ¶
func (*EIPUDP) ListIdentity ¶
func (e *EIPUDP) ListIdentity()
func (*EIPUDP) ListIdentityDecode ¶
func (e *EIPUDP) ListIdentityDecode(encapsulationPacket *EncapsulationPacket) *ListIdentity
func (*EIPUDP) ListInterface ¶
func (e *EIPUDP) ListInterface()
func (*EIPUDP) ListInterfaceDecode ¶
func (e *EIPUDP) ListInterfaceDecode(encapsulationPacket *EncapsulationPacket) *ListInterface
func (*EIPUDP) ListServices ¶
func (e *EIPUDP) ListServices()
func (*EIPUDP) ListServicesDecode ¶
func (e *EIPUDP) ListServicesDecode(encapsulationPacket *EncapsulationPacket) *ListServices
type EncapsulationHeader ¶
type EncapsulationPacket ¶
type EncapsulationPacket struct {
EncapsulationHeader
CommandSpecificData []byte
}
func NewListIdentity ¶
func NewListIdentity(context typedef.Ulint) *EncapsulationPacket
func NewListInterface ¶
func NewListInterface(context typedef.Ulint) *EncapsulationPacket
func NewListServices ¶
func NewListServices(context typedef.Ulint) *EncapsulationPacket
func NewNOP ¶
func NewNOP(data []byte) *EncapsulationPacket
func NewRegisterSession ¶
func NewRegisterSession(context typedef.Ulint) *EncapsulationPacket
func NewSendRRData ¶
func NewSendRRData(session typedef.Udint, context typedef.Ulint, cpf *CommonPacketFormat, timeout typedef.Uint) *EncapsulationPacket
func NewSendUnitData ¶
func NewSendUnitData(session typedef.Udint, context typedef.Ulint, cpf *CommonPacketFormat, timeout typedef.Uint) *EncapsulationPacket
func NewUnRegisterSession ¶
func NewUnRegisterSession(session typedef.Udint, context typedef.Ulint) *EncapsulationPacket
func (*EncapsulationPacket) Encode ¶
func (e *EncapsulationPacket) Encode() ([]byte, error)
type FragmentedReadResponse ¶
type FragmentedReadResponse struct {
ReplyService typedef.Usint
Reserved typedef.Usint
GeneralStatus typedef.Usint
SizeOfAdditionalStatus typedef.Usint
AdditionalStatus []byte
TagTypeValue uint16
ResponseData []byte
}
func (*FragmentedReadResponse) Decode ¶
func (m *FragmentedReadResponse) Decode(data []byte, isString bool)
type ItemID ¶
const ( ItemIDUCMM ItemID = 0x0000 ItemIDListIdentityResponse ItemID = 0x000C ItemIDConnectionBased ItemID = 0x00A1 ItemIDConnectedTransportPacket ItemID = 0x00B1 ItemIDUnconnectedMessage ItemID = 0x00B2 ItemIDListServicesResponse ItemID = 0x0100 ItemIDSockaddrInfoO2T ItemID = 0x8000 ItemIDSockaddrInfoT2O ItemID = 0x8001 ItemIDSequencedAddressItem ItemID = 0x8002 )
type ListIdentity ¶
type ListIdentity struct {
ItemCount typedef.Uint
Items []ListIdentityItem
}
func (*ListIdentity) Decode ¶
func (l *ListIdentity) Decode(data []byte)
type ListIdentityItem ¶
type ListIdentityItem struct {
ItemTypeCode typedef.Uint
ItemLength typedef.Uint
EncapsulationProtocolVersion typedef.Uint
SinFamily typedef.Int
SinPort typedef.Uint
SinAddr typedef.Udint
SinZero typedef.Ulint
VendorID typedef.Uint
DeviceType typedef.Uint
ProductCode typedef.Uint
Major typedef.Usint
Minor typedef.Usint
Status typedef.Word
SerialNumber typedef.Udint
NameLength typedef.Usint
ProductName []byte
State typedef.Usint
}
type ListInterface ¶
type ListInterface struct {
ItemCount typedef.Uint
Items []ListInterfaceItem
}
func (*ListInterface) Decode ¶
func (l *ListInterface) Decode(data []byte)
type ListInterfaceItem ¶
type ListServices ¶
type ListServices struct {
ItemCount typedef.Uint
Items []ListServicesItem
}
func (*ListServices) Decode ¶
func (l *ListServices) Decode(data []byte)
type ListServicesItem ¶
type MessageRouterRequest ¶
type MessageRouterRequest struct {
Service typedef.Usint
RequestPathSize typedef.Usint
RequestPath []byte
RequestData []byte
}
func (*MessageRouterRequest) Encode ¶
func (m *MessageRouterRequest) Encode() []byte
type MessageRouterResponse ¶
type MessageRouterResponse struct {
ReplyService typedef.Usint
Reserved typedef.Usint
GeneralStatus typedef.Usint
SizeOfAdditionalStatus typedef.Usint
AdditionalStatus []byte
ResponseData []byte
}
func (*MessageRouterResponse) Decode ¶
func (m *MessageRouterResponse) Decode(data []byte)
type SendDataSpecificData ¶
type SendDataSpecificData struct {
InterfaceHandle typedef.Udint
TimeOut typedef.Uint
Packet *CommonPacketFormat
}
func (*SendDataSpecificData) Decode ¶
func (r *SendDataSpecificData) Decode(data []byte)
func (*SendDataSpecificData) Encode ¶
func (r *SendDataSpecificData) Encode() []byte
Source Files
¶
Click to show internal directories.
Click to hide internal directories.