Documentation ¶
Index ¶
- Constants
- func DiscoverPLCs()
- func FromDateTime(t uint64) time.Time
- func ToDateTime(t time.Time) uint64
- type ChannelStatistics
- type Endpoint
- type FileInfo
- type Frame
- type LoginResponse
- type PLCConnection
- func (self *PLCConnection) FinishDataSend(crc uint16) error
- func (self *PLCConnection) GetBasicInfo(_serialnumber string, _username string, _password string) (*PLCInfo, error)
- func (self *PLCConnection) GetChannelStatistics(channelName string) (*ChannelStatistics, error)
- func (self *PLCConnection) GetPLCStatistics() (*PLCStatistics, error)
- func (self *PLCConnection) GetTaskStatistics(taskId uint8) (*TaskStatistics, error)
- func (self *PLCConnection) InitiateDataReceive(filename string) (*FileInfo, error)
- func (self *PLCConnection) InitiateDataSend(filename string, size uint32, time time.Time) error
- func (self *PLCConnection) Login(username string, password string, proxyId string, maxDataSize uint16) (*LoginResponse, error)
- func (self *PLCConnection) Logout() error
- func (self *PLCConnection) ReadVariablesDirectly(vars []*Variable, taskId *uint8) error
- func (self *PLCConnection) ReceiveDataChunk(offset uint32) (uint32, []byte, error)
- func (self *PLCConnection) RecvFile(filename string) ([]byte, error)
- func (self *PLCConnection) SendDataChunk(offset uint32, data []byte) error
- func (self *PLCConnection) SendFile(filename string, content []byte) error
- func (self *PLCConnection) TimeSetup(t *time.Time) (*time.Time, error)
- func (self *PLCConnection) TimeSetupExtended(command byte, t *time.Time) (*time.Time, error)
- func (self *PLCConnection) WriteVariablesDirectly(vars []*Variable) error
- type PLCInfo
- type PLCStatistics
- type TaskStatistics
- type Variable
Constants ¶
const ( FILE_RT_IMAGE = "/sys/sexm" FILE_RT_UPGRADE_IMAGE = "/sys/rt" FILE_SHARK_IMAGE_1 = "/sys/sex1" FILE_SHARK_IMAGE_2 = "/sys/sex2" FILE_PLC_CAPS = "/sys/caps" FILE_VAR_DIRECT = "/var/direct" FILE_LOGS = "/log" )
const ( PROXY_DISABLED = 0 PROXY_NOTUSED = 1 PROXY_IDLE = 2 PROXY_CONNECTED = 3 PROXY_UNAUTHORIZED = 4 PROXY_NOTAVAILABLE = 5 PROXY_FAILEDTOCONNECT = 6 PROXY_HOSTNOTFOUND = 7 PROXY_CONNECTING = 8 PROXY_PAGENOTFOUND = 9 PROXY_DBERROR = 10 )
const ( RUN_MODE_FULL_RUN = 0 RUN_MODE_CommunicationOnly = 1 RUN_MODE_EvaluationOnly = 2 RUN_MODE_Commissioning = 3 RUN_MODE_CommunicationsWithTransform = 4 RUN_MODE_PrepareOnly = 5 RUN_MODE_StartDisabledBySwitch = 32 RUN_MODE_InvalidImageVersion = 33 RUN_MODE_NoMemoryForImage = 34 )
const ( EVAL_STATE_Stopped = 0 EVAL_STATE_RunningNormalTasks = 1 EVAL_STATE_StoppingExecution = 2 EVAL_STATE_RunningExceptionStateTask = 3 EVAL_STATE_ExceptionStateTaskFailed = 4 EVAL_STATE_NoExceptionStateTaskDefined = 5 EVAL_STATE_Commissioning = 6 EVAL_STATE_InvalidImage = 7 EVAL_STATE_NoImage = 8 EVAL_STATE_WaitingForDebugger = 9 EVAL_STATE_PreparedForStart = 10 )
const ( RTC_GET_UTC = 0x01 RTC_GET_LOCAL = 0x02 RTC_SET_UTC = 0x10 RTC_SET_LOCAL = 0x11 RTC_GET_TIMEZONE_OFFSET = 0x20 RTC_GET_DAYLIGHT_OFFSET = 0x21 )
Variables ¶
This section is empty.
Functions ¶
func FromDateTime ¶
Converts 100ns timestamp from 01-01-0001 to time data type https://msdn.microsoft.com/en-us/library/system.datetime.ticks(v=vs.110).aspx
func ToDateTime ¶
Converts time data type to 100ns timestamp from 01-01-0001 https://msdn.microsoft.com/en-us/library/system.datetime.ticks(v=vs.110).aspx
Types ¶
type ChannelStatistics ¶
type LoginResponse ¶
type PLCConnection ¶
type PLCConnection struct {
// contains filtered or unexported fields
}
func NewPLCConnection ¶
func NewPLCConnection(host string, addr uint8, reconnect bool) (*PLCConnection, error)
func NewPLCConnectionFrom ¶
func NewPLCConnectionFrom(conn net.Conn, addr uint8, reconnect bool) PLCConnection
func (*PLCConnection) FinishDataSend ¶
func (self *PLCConnection) FinishDataSend(crc uint16) error
This functionality defined on the section 5.6.1 of the specification
func (*PLCConnection) GetBasicInfo ¶
func (self *PLCConnection) GetBasicInfo(_serialnumber string, _username string, _password string) (*PLCInfo, error)
This function simply gets basic information of the PLC. (This functionality defined on the section 5.4.1 of the specification)
func (*PLCConnection) GetChannelStatistics ¶
func (self *PLCConnection) GetChannelStatistics(channelName string) (*ChannelStatistics, error)
This functionality defined on the section 5.7.3 of the specification
func (*PLCConnection) GetPLCStatistics ¶
func (self *PLCConnection) GetPLCStatistics() (*PLCStatistics, error)
This functionality defined on the section 5.7.1 of the specification
func (*PLCConnection) GetTaskStatistics ¶
func (self *PLCConnection) GetTaskStatistics(taskId uint8) (*TaskStatistics, error)
This functionality defined on the section 5.7.2 of the specification
func (*PLCConnection) InitiateDataReceive ¶
func (self *PLCConnection) InitiateDataReceive(filename string) (*FileInfo, error)
This functionality defined on the section 5.6.2 of the specification
func (*PLCConnection) InitiateDataSend ¶
This functionality defined on the section 5.6.1 of the specification
func (*PLCConnection) Login ¶
func (self *PLCConnection) Login(username string, password string, proxyId string, maxDataSize uint16) (*LoginResponse, error)
This functionality defined on the section 5.5.4 of the specification
func (*PLCConnection) Logout ¶
func (self *PLCConnection) Logout() error
This functionality defined on the section 5.5.5 of the specification
func (*PLCConnection) ReadVariablesDirectly ¶
func (self *PLCConnection) ReadVariablesDirectly(vars []*Variable, taskId *uint8) error
This functionality defined on the section 5.8.1.1 of the specification It simply takes a list of variables and mutates their values.
func (*PLCConnection) ReceiveDataChunk ¶
func (self *PLCConnection) ReceiveDataChunk(offset uint32) (uint32, []byte, error)
This functionality defined on the section 5.6.2 of the specification
func (*PLCConnection) RecvFile ¶
func (self *PLCConnection) RecvFile(filename string) ([]byte, error)
This function recieves a complete file.
func (*PLCConnection) SendDataChunk ¶
func (self *PLCConnection) SendDataChunk(offset uint32, data []byte) error
This functionality defined on the section 5.6.1 of the specification
func (*PLCConnection) SendFile ¶
func (self *PLCConnection) SendFile(filename string, content []byte) error
This function sends a complete file.
func (*PLCConnection) TimeSetup ¶
This functionality defined on the section 5.9.1 of the specification
func (*PLCConnection) TimeSetupExtended ¶
func (*PLCConnection) WriteVariablesDirectly ¶
func (self *PLCConnection) WriteVariablesDirectly(vars []*Variable) error
This functionality defined on the section 5.8.1.2 of the specification
type PLCInfo ¶
type PLCInfo struct { SizeOfConfigBlock uint16 SerialNumber []byte Endianness byte PlatformId uint32 RuntimeVersion []byte Name *string SlaveAddr *uint8 TCPPort *uint16 SSLTCPPort *uint16 }
This type represents PLC Information
func (PLCInfo) GetPlatformString ¶
type PLCStatistics ¶
type PLCStatistics struct { StatisticsVersion uint8 BlockLength uint16 NormalTaskCount uint8 MaxTaskId uint8 EvaluatorState uint8 RunMode uint8 UpTime uint64 RunningTasks uint64 TasksWithException uint64 TotalHeap uint16 FreeHeapBeforeLoad uint16 FreeHeap uint16 TotalCodeSpace uint16 FreeCodeSpace uint16 RetainSize uint16 AllocatorTotalSize uint16 AllocatorFreeSpace uint16 VMEXSection uint16 RTCMSection uint16 OtherSections uint16 ClientStatus uint8 RecordsSaved uint32 LastSaveTime uint64 LastRequestTime uint64 ProxyStatus uint8 ProxyId []byte SlotsTotal uint8 SlotsFree uint8 }