mcp

package
v0.0.0-...-2bf79c4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 29, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SUB_HEADER = "5000" // 3Eフレームでは固定

	HEALTH_CHECK_COMMAND    = "1906" // binary mode expression. if ascii mode then 0619
	HEALTH_CHECK_SUBCOMMAND = "0000"

	READ_COMMAND         = "0104" // binary mode expression. if ascii mode then 0401
	READ_SUB_COMMAND     = "0000"
	BIT_READ_SUB_COMMAND = "0100"

	WRITE_COMMAND         = "0114" // binary mode expression. if ascii mode then 1401
	WRITE_SUB_COMMAND     = "0000"
	BIT_WRITE_SUB_COMMAND = "0100"

	MONITORING_TIMER = "1000" // 3[sec]
)

Variables

View Source
var DeviceCodes = map[string]string{
	"X": "9C",
	"Y": "9D",
	"M": "90",
	"L": "92",
	"F": "93",
	"V": "94",
	"B": "A0",
	"W": "B4",
	"D": "A8",
}

DeviceCodes is device name and hex value map

Functions

func NewLocalStation

func NewLocalStation() *station

local stn stn. local stn is 自局.

func NewParser

func NewParser() *parser

func NewStation

func NewStation(networkNum, pcNum, unitIONum, unitStationNum string) *station

Types

type AccessRoute

type AccessRoute struct {
	Sts  station
	Code Code
}

func (*AccessRoute) AsciiRoute

func (r *AccessRoute) AsciiRoute() []byte

func (*AccessRoute) BinaryRoute

func (r *AccessRoute) BinaryRoute() []byte

func (*AccessRoute) Len

func (r *AccessRoute) Len() int64

type Client

type Client interface {
	Read(deviceName string, offset, numPoints int64) ([]byte, error)
	BitRead(deviceName string, offset, numPoints int64) ([]byte, error)
	Write(deviceName string, offset, numPoints int64, writeData []byte) ([]byte, error)
	BitWrite(deviceName string, offset, numPoints int64, writeData []byte) ([]byte, error)
	HealthCheck() error
	ShutDown()
	Reconnect() error
	Connect() error
}

func New3EClient

func New3EClient(host string, port int, stn *station, keep_alive bool) (Client, error)

type Code

type Code int

PLC Data communication code. This item is operating byte order.

const (
	// Ascii code is normal mode.
	// Stored from upper byte to lower byte.
	Ascii Code = iota

	// Binary code is approximately half the amount of communication data compared to communication using ASCII code
	// Stored from lower byte to upper byte.
	Binary
)

func (Code) EncodeHex

func (c Code) EncodeHex(s string) ([]byte, error)

type Response

type Response struct {
	// Sub header
	SubHeader string
	// network number
	NetworkNum string
	// PC number
	PCNum string
	// Request Unit I/O number
	UnitIONum string
	// Request Unit station number
	UnitStationNum string
	// Response data length
	DataLen string
	// Response data code
	EndCode string
	// Response data
	Payload []byte
	// error data
	ErrInfo []byte
}

Response represents mcp response

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL