Documentation ¶
Index ¶
- Constants
- func ParseAddress(address string) (requestItem common.RequestItem, err error)
- type AckHeader
- func (a *AckHeader) GetDataLength() uint16
- func (a *AckHeader) GetMessageType() common.MessageType
- func (a *AckHeader) GetParameterLength() uint16
- func (a *AckHeader) GetPduReference() uint16
- func (a *AckHeader) GetProtocolId() byte
- func (a *AckHeader) GetReserved() []byte
- func (a *AckHeader) Len() int
- func (a *AckHeader) SetDataLength(u uint16)
- func (a *AckHeader) SetMessageType(messageType common.MessageType)
- func (a *AckHeader) SetParameterLength(u uint16)
- func (a *AckHeader) SetPduReference(u uint16)
- func (a *AckHeader) SetProtocolId(b byte)
- func (a *AckHeader) SetReserved(bytes []byte)
- func (a *AckHeader) ToBytes() []byte
- type BlockInfo
- type BlockInfoAckDatum
- type BlockInfoDatum
- type BlockListAckDatum
- type BlockListTypeAckDatum
- type BlockListTypeDatum
- type COTPConnection
- type COTPData
- type Catalog
- type ClockAckDatum
- type CommunicationInfo
- type DataItem
- func DataItemFromBytes(bytes []byte) (*DataItem, error)
- func NewAckDataItem(bytes []byte, variableType common.DataVariableType) *DataItem
- func NewReqDataItem(bytes []byte, variableType common.DataVariableType) *DataItem
- func NewReqDataItemByBool(b bool) *DataItem
- func NewReqDataItemByByte(b byte) *DataItem
- func NewReqDataItemByBytes(bytes []byte) *DataItem
- type DownloadParameter
- type EndDownloadParameter
- type EndUploadParameter
- type ListBlockInfo
- type ListBlockTypeInfo
- type NckRequestItem
- func (n *NckRequestItem) GetLengthOfFollowing() byte
- func (n *NckRequestItem) GetSpecificationType() byte
- func (n *NckRequestItem) GetSyntaxId() common.SyntaxID
- func (n *NckRequestItem) Len() int
- func (n *NckRequestItem) SetLengthOfFollowing(b byte)
- func (n *NckRequestItem) SetSpecificationType(b byte)
- func (n *NckRequestItem) SetSyntaxId(id common.SyntaxID)
- func (n *NckRequestItem) ToBytes() []byte
- type PDU
- func DataFromBytes(bytes []byte) (d *PDU, err error)
- func NewBlockInfo(bt common.BlockType, dfs common.DestinationFileSystem, bn int, ...) *PDU
- func NewBlockList(requestId uint16) *PDU
- func NewBlockListType(bt common.BlockType, requestId uint16) *PDU
- func NewClearPassword(requestId uint16) *PDU
- func NewClockRead(requestId uint16) *PDU
- func NewClockSet(t time.Time, requestId uint16) *PDU
- func NewColdRestart(requestId uint16) *PDU
- func NewCompress(requestId uint16) *PDU
- func NewConnectDt(pduLength uint16, requestId uint16) *PDU
- func NewConnectRequest(local uint16, remote uint16) *PDU
- func NewCopyRamToRom(requestId uint16) *PDU
- func NewDownload(bt common.BlockType, dfs common.DestinationFileSystem, bn int, ...) *PDU
- func NewEndDownload(bt common.BlockType, dfs common.DestinationFileSystem, bn int, ...) *PDU
- func NewEndUpload(id uint32, requestId uint16) *PDU
- func NewHotRestart(requestId uint16) *PDU
- func NewInsert(bt common.BlockType, dfs common.DestinationFileSystem, bn int, ...) *PDU
- func NewReadRequest(items []common.RequestItem, requestId uint16) *PDU
- func NewReadSzl(szlId uint16, szlIndex uint16, requestId uint16) *PDU
- func NewSetPassword(pwd string, requestId uint16) *PDU
- func NewStartDownload(bt common.BlockType, dfs common.DestinationFileSystem, bn int, ...) *PDU
- func NewStartUpload(bt common.BlockType, dfs common.DestinationFileSystem, bn int, ...) *PDU
- func NewStopPlc(requestId uint16) *PDU
- func NewUpload(id uint32, requestId uint16) *PDU
- func NewWriteRequest(reqItems []common.RequestItem, dateItems []common.ResponseItem, ...) *PDU
- type PlcControlAckParameter
- type PlcControlInsertParamBlock
- type PlcControlParameter
- func NewColdRestartPlcControlParameter() *PlcControlParameter
- func NewCompressPlcControlParameter() *PlcControlParameter
- func NewCopyRamToRomPlcControlParameter() *PlcControlParameter
- func NewHotRestartPlcControlParameter() *PlcControlParameter
- func NewInsertPlcControlParameter(bt common.BlockType, bn int, dfs common.DestinationFileSystem) *PlcControlParameter
- func PlcControlParameterFromBytes(bytes []byte) (*PlcControlParameter, error)
- type PlcControlStringParamBlock
- type PlcStatus
- type PlcStopParameter
- type ProtectionInfo
- type ReadSzlAckDatum
- type ReadSzlDatum
- type ReadWriteDatum
- type ReadWriteParameter
- type RequestHeader
- func (h *RequestHeader) GetDataLength() uint16
- func (h *RequestHeader) GetMessageType() common.MessageType
- func (h *RequestHeader) GetParameterLength() uint16
- func (h *RequestHeader) GetPduReference() uint16
- func (h *RequestHeader) GetProtocolId() byte
- func (h *RequestHeader) GetReserved() []byte
- func (h *RequestHeader) Len() int
- func (h *RequestHeader) SetDataLength(u uint16)
- func (h *RequestHeader) SetMessageType(messageType common.MessageType)
- func (h *RequestHeader) SetParameterLength(u uint16)
- func (h *RequestHeader) SetPduReference(u uint16)
- func (h *RequestHeader) SetProtocolId(b byte)
- func (h *RequestHeader) SetReserved(bytes []byte)
- func (h *RequestHeader) ToBytes() []byte
- type ReturnItem
- type SetPasswordDatum
- type SetupComParameter
- type StandardParameter
- type StandardRequestItem
- func NewStandardRequestItem(area common.AreaType, dbNumber int, variableType common.ParamVariableType, ...) *StandardRequestItem
- func StandardRequestItemFromBytes(bytes []byte) (*StandardRequestItem, error)
- func StandardRequestItemFromBytesWithOffset(bytes []byte, offset int) (*StandardRequestItem, error)
- func (s *StandardRequestItem) GetLengthOfFollowing() byte
- func (s *StandardRequestItem) GetSpecificationType() byte
- func (s *StandardRequestItem) GetSyntaxId() common.SyntaxID
- func (s *StandardRequestItem) Len() int
- func (s *StandardRequestItem) SetLengthOfFollowing(b byte)
- func (s *StandardRequestItem) SetSpecificationType(b byte)
- func (s *StandardRequestItem) SetSyntaxId(id common.SyntaxID)
- func (s *StandardRequestItem) ToBytes() []byte
- type StartDownloadParameter
- type StartUploadAckParameter
- type StartUploadParameter
- type TPKT
- type UnitInfo
- type UpDownloadDatum
- type UploadAckParameter
- type UploadParameter
- type UserdataAckParameter
- type UserdataDatum
- type UserdataParameter
- func NewBlockParameter(function common.BlockSubFunction) *UserdataParameter
- func NewClockParameter(function common.TimeSubFunction) *UserdataParameter
- func NewCpuParameter(function common.CpuSubFunction) *UserdataParameter
- func NewSecurityParameter(function common.SecuritySubFunction) *UserdataParameter
- func UserdataParameterFromBytes(bytes []byte) (*UserdataParameter, error)
Constants ¶
const ( PsUnknown PlcStatus = 0x00 PsRun = 0x08 PsStop = 0x04 )
Variables ¶
This section is empty.
Functions ¶
func ParseAddress ¶
func ParseAddress(address string) (requestItem common.RequestItem, err error)
Types ¶
type AckHeader ¶
type AckHeader struct { // ProtocolId 协议id // 字节大小:1 // 字节序数:0 ProtocolId byte // MessageType pdu(协议数据单元(Protocol Data Unit))的类型 // 字节大小:1 // 字节序数:1 MessageType common.MessageType // Reserved 保留 // 字节大小:2 // 字节序数:2-3 Reserved []byte // PduReference pdu的参考–由主站生成,每次新传输递增,大端 // 字节大小:2 // 字节序数:4-5 PduReference uint16 // ParameterLength 参数的长度(大端) // 字节大小:2 // 字节序数:6-7 ParameterLength uint16 // DataLength 数据的长度(大端) // 字节大小:2 // 字节序数:8-9 DataLength uint16 // ErrorClass 错误类型 // 字节大小:1 // 字节序数:10 ErrorClass byte // ErrorCode 错误码 // 本来是1个字节的,但本质上errorCode(真正) = errorClass + errorCode(原) // 字节大小:2 // 字节序数:10-11 ErrorCode []byte }
func AckHeaderFromBytes ¶
func (*AckHeader) GetDataLength ¶
func (*AckHeader) GetMessageType ¶
func (a *AckHeader) GetMessageType() common.MessageType
func (*AckHeader) GetParameterLength ¶
func (*AckHeader) GetPduReference ¶
func (*AckHeader) GetProtocolId ¶
func (*AckHeader) GetReserved ¶
func (*AckHeader) SetDataLength ¶
func (*AckHeader) SetMessageType ¶
func (a *AckHeader) SetMessageType(messageType common.MessageType)
func (*AckHeader) SetParameterLength ¶
func (*AckHeader) SetPduReference ¶
func (*AckHeader) SetProtocolId ¶
func (*AckHeader) SetReserved ¶
type BlockInfo ¶
type BlockInfo struct { BlockType int BlockNumber int Language int Flags int MC7CodeLength int LengthLoadMemory int LocalDataLength int SBBLength int CheckSum int Version int CodeDate time.Time InterfaceDate time.Time Author string Family string Header string }
BlockInfo Managed Block Info
type BlockInfoAckDatum ¶
type BlockInfoAckDatum struct { // ReturnCode 返回码 // 字节大小:1 // 字节序数:0 ReturnCode common.ReturnCode // VariableType 数据类型 // 字节大小:1 // 字节序数:1 VariableType common.DataVariableType // Length 长度 // 字节大小:2 // 字节序数:2-3 Length uint16 // BlockType 块类型 // 字节大小:2 // 字节序数:4-5 BlockType uint16 // LengthOfInfo 信息长度 // 字节大小:2 // 字节序数:6-7 LengthOfInfo uint16 // Reserved1 保留 // 字节大小:2 // 字节序数:8-9 Reserved1 []byte // Constant 常量 // 字节大小:2 // 字节序数:10-11 Constant []byte // Reserved2 保留 // 字节大小:1 // 字节序数:12 Reserved2 byte // Flags 标记 // 字节大小:1 // 字节序数:13 Flags byte // Language 语言 // 字节大小:1 // 字节序数:14 Language byte // SubBlkType // 字节大小:1 // 字节序数:15 SubBlkType byte // BlockNumber 序号 // 字节大小:2 // 字节序数:16-17 BlockNumber uint16 // LengthLoadMemory 加载内存长度 // 字节大小:4 // 字节序数:18-21 LengthLoadMemory uint32 // BlockSecurity 安全类型 // 字节大小:4 // 字节序数:22-25 BlockSecurity uint32 // CodeTimestamp 代码时间戳 // 字节大小:6 // 字节序数:26-31 CodeTimestamp []byte // InterfaceTimestamp 接口时间戳 // 字节大小:6 // 字节序数:32-37 InterfaceTimestamp []byte // SBBLength SBB长度 // 字节大小:2 // 字节序数:38-39 SBBLength uint16 // ADDLength ADD长度 // 字节大小:2 // 字节序数:40-41 ADDLength uint16 // LocalDataLength 本地数据长度 // 字节大小:2 // 字节序数:42-43 LocalDataLength uint16 // MC7CodeLength MC7代码长度 // 字节大小:2 // 字节序数:44-45 MC7CodeLength uint16 // Auth 作者 // 字节大小:8 // 字节序数:46-53 Auth []byte // Family family // 字节大小:8 // 字节序数:54-61 Family []byte // Header 名称 // 字节大小:8 // 字节序数:62-69 Header []byte // Version 版本 // 字节大小:1 // 字节序数:70 Version uint8 // Reserved3 保留 // 字节大小:1 // 字节序数:71 Reserved3 byte // CheckSum 校验和 // 字节大小:2 // 字节序数:72-73 CheckSum uint16 // Reserved4 保留 // 字节大小:4 // 字节序数:74-77 Reserved4 []byte // Reserved5 保留 // 字节大小:4 // 字节序数:78-81 Reserved5 []byte }
func BlockInfoAckDatumFromBytes ¶
func BlockInfoAckDatumFromBytes(bytes []byte) (*BlockInfoAckDatum, error)
func (*BlockInfoAckDatum) Len ¶
func (b *BlockInfoAckDatum) Len() int
func (*BlockInfoAckDatum) ToBytes ¶
func (b *BlockInfoAckDatum) ToBytes() []byte
type BlockInfoDatum ¶
type BlockInfoDatum struct { // ReturnCode 返回码 // 字节大小:1 // 字节序数:0 ReturnCode common.ReturnCode // VariableType 数据类型 // 字节大小:1 // 字节序数:1 VariableType common.DataVariableType // Length 长度 // 字节大小:2 // 字节序数:2-3 Length uint16 // BlockType 块类型 // 字节大小:2 // 字节序数:4-5 BlockType common.BlockType // BlockNumber 数据块编号,范围00000-99999 // 字节大小:5 // 字节序数:6-10 BlockNumber int // DestinationFileSystem 目标文件系统 // 字节大小:1 // 字节序数:11 DestinationFileSystem common.DestinationFileSystem }
func NewBlockInfoDatum ¶
func NewBlockInfoDatum(bt common.BlockType, dfs common.DestinationFileSystem, blockNumber int) *BlockInfoDatum
func (*BlockInfoDatum) Len ¶
func (b *BlockInfoDatum) Len() int
func (*BlockInfoDatum) ToBytes ¶
func (b *BlockInfoDatum) ToBytes() []byte
type BlockListAckDatum ¶
type BlockListAckDatum struct { // ReturnCode 返回码 // 字节大小:1 // 字节序数:0 ReturnCode common.ReturnCode // VariableType 数据类型 // 字节大小:1 // 字节序数:1 VariableType common.DataVariableType // Length 长度 // 字节大小:2 // 字节序数:2-3 Length uint16 // Blocks 块信息(数量) Blocks []ListBlockInfo }
func BlockListAckDatumFromBytes ¶
func BlockListAckDatumFromBytes(bytes []byte) (*BlockListAckDatum, error)
func (*BlockListAckDatum) Len ¶
func (b *BlockListAckDatum) Len() int
func (*BlockListAckDatum) ToBytes ¶
func (b *BlockListAckDatum) ToBytes() []byte
type BlockListTypeAckDatum ¶
type BlockListTypeAckDatum struct { // ReturnCode 返回码 // 字节大小:1 // 字节序数:0 ReturnCode common.ReturnCode // VariableType 数据类型 // 字节大小:1 // 字节序数:1 VariableType common.DataVariableType // Length 长度 // 字节大小:2 // 字节序数:2-3 Length uint16 // Types 块类型信息 Types []ListBlockTypeInfo }
func BlockListTypeAckDatumFromBytes ¶
func BlockListTypeAckDatumFromBytes(bytes []byte) (*BlockListTypeAckDatum, error)
func (*BlockListTypeAckDatum) Len ¶
func (b *BlockListTypeAckDatum) Len() int
func (*BlockListTypeAckDatum) ToBytes ¶
func (b *BlockListTypeAckDatum) ToBytes() []byte
type BlockListTypeDatum ¶
type BlockListTypeDatum struct { // ReturnCode 返回码 // 字节大小:1 // 字节序数:0 ReturnCode common.ReturnCode // VariableType 数据类型 // 字节大小:1 // 字节序数:1 VariableType common.DataVariableType // Length 长度 // 字节大小:2 // 字节序数:2-3 Length uint16 // BlockType 块类型 // 字节大小:2 // 字节序数:4-5 BlockType common.BlockType }
func NewBlockListTypeDatum ¶
func NewBlockListTypeDatum(bt common.BlockType) *BlockListTypeDatum
func (*BlockListTypeDatum) Len ¶
func (b *BlockListTypeDatum) Len() int
func (*BlockListTypeDatum) ToBytes ¶
func (b *BlockListTypeDatum) ToBytes() []byte
type COTPConnection ¶
type COTPConnection struct { // Length 长度(但并不包含length这个字段) // 字节大小:1 // 字节序数:0 Length uint8 // PduType PDU类型(CRConnect Request 连接请求) // 字节大小:1 // 字节序数:1 PduType common.PduType // DestinationReference 目标引用,用来唯一标识目标 // 字节大小:2 // 字节序数:2-3 DestinationReference []byte // SourceReference 源引用 // 字节大小:2 // 字节序数:4-5 SourceReference []byte // Flags 扩展格式/流控制 前四位标识Class, 倒数第二位Extended formats // 倒数第一位No explicit flow control // 字节大小:1 // 字节序数:6 Flags byte // ParameterCodeTpduSize 参数代码TPDU-Size // 字节大小:1 // 字节序数:7 ParameterCodeTpduSize byte // ParameterLength1 参数长度 // 字节大小:1 // 字节序数:8 ParameterLength1 byte // TpduSize TPDU大小 TPDU Size (2^10 = 1024) // 字节大小:1 // 字节序数:9 TpduSize byte // ParameterCodeSrcTsap 参数代码SRC-TASP // 字节大小:1 // 字节序数:10 ParameterCodeSrcTsap byte // ParameterLength2 参数长度 // 字节大小:1 // 字节序数:11 ParameterLength2 byte // SourceTsap SourceTSAP/Rack // 字节大小:2 // 字节序数:12-13 SourceTsap []byte // ParameterCodeDstTsap 参数代码DST-TASP // 字节大小:1 // 字节序数:14 ParameterCodeDstTsap byte // ParameterLength3 参数长度 // 字节大小:1 // 字节序数:15 ParameterLength3 byte // DestinationTsap Slot // 字节大小:2 // 字节序数:16-17 DestinationTsap []byte }
func COTPConnectionFromBytes ¶
func COTPConnectionFromBytes(bytes []byte) (*COTPConnection, error)
func NewCOTPConnection ¶
func NewCOTPConnection() *COTPConnection
func NewCOTPConnectionForConfirm ¶
func NewCOTPConnectionForConfirm(request *COTPConnection) *COTPConnection
func NewCOTPConnectionForRequest ¶
func NewCOTPConnectionForRequest(local uint16, remote uint16) *COTPConnection
CRConnect Request 连接请求 @param local 本地参数 @param remote 远程参数
func (*COTPConnection) GetLength ¶
func (c *COTPConnection) GetLength() byte
func (*COTPConnection) GetPduType ¶
func (c *COTPConnection) GetPduType() common.PduType
func (*COTPConnection) Len ¶
func (c *COTPConnection) Len() int
func (*COTPConnection) SetLength ¶
func (c *COTPConnection) SetLength(length byte)
func (*COTPConnection) SetPduType ¶
func (c *COTPConnection) SetPduType(pduType common.PduType)
func (*COTPConnection) ToBytes ¶
func (c *COTPConnection) ToBytes() []byte
type COTPData ¶
type COTPData struct { // Length 长度(但并不包含length这个字段) // 字节大小:1 // 字节序数:0 Length uint8 // PduType PDU类型(PtData 数据) // 字节大小:1 // 字节序数:1 PduType common.PduType // TpduNumber TPDU编号 // 字节大小:1,后面7位 // 字节序数:2 TpduNumber byte // LastDataUnit 是否最后一个数据单元 // 字节大小:1,最高位,7位 // 字节序数:2 LastDataUnit bool }
func COTPDataFromBytes ¶
func NewCOTPData ¶
func NewCOTPData() *COTPData
func (*COTPData) GetPduType ¶
func (*COTPData) SetPduType ¶
type ClockAckDatum ¶
type ClockAckDatum struct { // ReturnCode 返回码 // 字节大小:1 // 字节序数:0 ReturnCode common.ReturnCode // VariableType 数据类型 // 字节大小:1 // 字节序数:1 VariableType common.DataVariableType // Length 长度 // 字节大小:2 // 字节序数:2-3 Length uint16 // Reserved 保留 // 字节大小:1 // 字节序数:4 Reserved byte // Year1 年份前两位 // 字节大小:1 // 字节序数:5 Year1 uint8 // Year2 年份后两位 // 字节大小:1 // 字节序数:6 Year2 uint8 // Month 月份 // 字节大小:1 // 字节序数:7 Month uint8 // Day 天 // 字节大小:1 // 字节序数:8 Day uint8 // Hour 小时 // 字节大小:1 // 字节序数:9 Hour uint8 // Minute 分 // 字节大小:1 // 字节序数:10 Minute uint8 // Second 秒 // 字节大小:1 // 字节序数:11 Second uint8 // MilliSecond 毫秒 // 字节大小:2 // 字节序数:12-13 MilliSecond uint16 }
func ClockAckDatumFromBytes ¶
func ClockAckDatumFromBytes(bytes []byte) (*ClockAckDatum, error)
func NewClockAckDatum ¶
func NewClockAckDatum(t time.Time) *ClockAckDatum
func (*ClockAckDatum) Len ¶
func (c *ClockAckDatum) Len() int
func (*ClockAckDatum) ToBytes ¶
func (c *ClockAckDatum) ToBytes() []byte
type CommunicationInfo ¶
CommunicationInfo communication info
func (CommunicationInfo) String ¶
func (c CommunicationInfo) String() string
type DataItem ¶
type DataItem struct { // ReturnCode 返回码 // 字节大小:1 // 字节序数:0 ReturnCode common.ReturnCode // VariableType 变量类型 // 字节大小:1 // 字节序数:1 VariableType common.DataVariableType // Count 数据长度 // 按位进行计算的,如果是字节数据读取需要进行 /8 或 *8操作 // 如果是位数据,不需要任何额外操作 Count uint16 // 数据内容 Data []byte }
func DataItemFromBytes ¶
func NewAckDataItem ¶
func NewAckDataItem(bytes []byte, variableType common.DataVariableType) *DataItem
func NewReqDataItem ¶
func NewReqDataItem(bytes []byte, variableType common.DataVariableType) *DataItem
func NewReqDataItemByBool ¶
func NewReqDataItemByByte ¶
func NewReqDataItemByBytes ¶
func (*DataItem) GetReturnCode ¶
func (d *DataItem) GetReturnCode() common.ReturnCode
func (*DataItem) SetReturnCode ¶
func (d *DataItem) SetReturnCode(code common.ReturnCode)
type DownloadParameter ¶
type DownloadParameter struct { // FunctionCode 功能码 // 字节大小:1 // 字节序数:0 FunctionCode common.FunctionCode // MoreDataFollowing + ErrorStatus // 字节大小:1 // 字节序数:1 // MoreDataFollowing 后续是否还有更多数据 MoreDataFollowing bool // ErrorStatus 错误状态 ErrorStatus bool // ErrorCode 未知字节 // 字节大小:2 // 字节序数:2-3 ErrorCode []byte // Id 下载的Id,4个字节 // 字节大小:4 // 字节序数:4-7 Id uint32 // FileNameLength 文件名长度 // 字节大小:1 // 字节序数:8 FileNameLength uint8 // FileId 文件id // 字节大小:1 // 字节序数:9 FileId uint8 // BlockType 数据块类型 // 字节大小:2 // 字节序数:10-11 BlockType common.BlockType // BlockNumber 数据块编号,范围00000-99999 // 字节大小:5 // 字节序数:12-16 BlockNumber int // DestinationFileSystem 目标文件系统 // 字节大小:1 // 字节序数:17 DestinationFileSystem common.DestinationFileSystem }
func DownloadParameterFromBytes ¶
func DownloadParameterFromBytes(bytes []byte) (*DownloadParameter, error)
func NewDownloadParameter ¶
func NewDownloadParameter(bt common.BlockType, dfs common.DestinationFileSystem, bn int, moreDataFollowing bool) *DownloadParameter
func (*DownloadParameter) Len ¶
func (d *DownloadParameter) Len() int
func (*DownloadParameter) ToBytes ¶
func (d *DownloadParameter) ToBytes() []byte
type EndDownloadParameter ¶
type EndDownloadParameter struct { // FunctionCode 功能码 // 字节大小:1 // 字节序数:0 FunctionCode common.FunctionCode // MoreDataFollowing + ErrorStatus // 字节大小:1 // 字节序数:1 // MoreDataFollowing 后续是否还有更多数据 MoreDataFollowing bool // ErrorStatus 错误状态 ErrorStatus bool // ErrorCode 未知字节 // 字节大小:2 // 字节序数:2-3 ErrorCode []byte // Id 下载的Id,4个字节 // 字节大小:4 // 字节序数:4-7 Id uint32 // FileNameLength 文件名长度 // 字节大小:1 // 字节序数:8 FileNameLength uint8 // FileId 文件id // 字节大小:1 // 字节序数:9 FileId uint8 // BlockType 数据块类型 // 字节大小:2 // 字节序数:10-11 BlockType common.BlockType // BlockNumber 数据块编号,范围00000-99999 // 字节大小:5 // 字节序数:12-16 BlockNumber int // DestinationFileSystem 目标文件系统 // 字节大小:1 // 字节序数:17 DestinationFileSystem common.DestinationFileSystem }
func EndDownloadParameterFromBytes ¶
func EndDownloadParameterFromBytes(bytes []byte) (*EndDownloadParameter, error)
func NewEndDownloadParameter ¶
func NewEndDownloadParameter(bt common.BlockType, dfs common.DestinationFileSystem, blockNumber int) *EndDownloadParameter
func (*EndDownloadParameter) Len ¶
func (e *EndDownloadParameter) Len() int
func (*EndDownloadParameter) ToBytes ¶
func (e *EndDownloadParameter) ToBytes() []byte
type EndUploadParameter ¶
type EndUploadParameter struct { // FunctionCode 功能码 // 字节大小:1 // 字节序数:0 FunctionCode common.FunctionCode // MoreDataFollowing + ErrorStatus // 字节大小:1 // 字节序数:1 // MoreDataFollowing 后续是否还有更多数据 MoreDataFollowing bool // ErrorStatus 错误状态 ErrorStatus bool // ErrorCode 未知字节 // 字节大小:2 // 字节序数:2-3 ErrorCode []byte // Id 下载的Id,4个字节 // 字节大小:4 // 字节序数:4-7 Id uint32 }
func EndUploadParameterFromBytes ¶
func EndUploadParameterFromBytes(bytes []byte) (*EndUploadParameter, error)
func NewEndUploadParameter ¶
func NewEndUploadParameter(id uint32) *EndUploadParameter
func (*EndUploadParameter) Len ¶
func (e *EndUploadParameter) Len() int
func (*EndUploadParameter) ToBytes ¶
func (e *EndUploadParameter) ToBytes() []byte
type ListBlockInfo ¶
type ListBlockTypeInfo ¶
type NckRequestItem ¶
type NckRequestItem struct { // SpecificationType 变量规范 // 对于读/写消息,它总是具有值0x12 // 字节大小:1 // 字节序数:0 SpecificationType byte // LengthOfFollowing 其余部分的长度规范 // 字节大小:1 // 字节序数:1 LengthOfFollowing byte // SyntaxId 寻址模式和项结构其余部分的格式,它具有任意类型寻址的常量值0x10 // 字节大小:1 // 字节序数:2 SyntaxId common.SyntaxID // Area NCK区域 // 字节大小:1 // 字节序数:3 Area common.AreaType // Unit 通道编号 // 字节大小:1 // 字节序数:3 Unit byte // ColumnNumber 列编号 // 字节大小:2 // 字节序数:4-5 ColumnNumber uint16 // LineNumber 行编号 // 字节大小:2 // 字节序数:6-7 LineNumber uint16 // Module 模块名 // 字节大小:1 // 字节序数:8 Module common.NckModule // LineCount 行个数 // 字节大小:1 // 字节序数:9 LineCount uint8 }
func NckRequestItemFromBytes ¶
func NckRequestItemFromBytes(bytes []byte) (*NckRequestItem, error)
func NckRequestItemFromBytesWithOffset ¶
func NckRequestItemFromBytesWithOffset(bytes []byte, offset int) (*NckRequestItem, error)
func (*NckRequestItem) GetLengthOfFollowing ¶
func (n *NckRequestItem) GetLengthOfFollowing() byte
func (*NckRequestItem) GetSpecificationType ¶
func (n *NckRequestItem) GetSpecificationType() byte
func (*NckRequestItem) GetSyntaxId ¶
func (n *NckRequestItem) GetSyntaxId() common.SyntaxID
func (*NckRequestItem) Len ¶
func (n *NckRequestItem) Len() int
func (*NckRequestItem) SetLengthOfFollowing ¶
func (n *NckRequestItem) SetLengthOfFollowing(b byte)
func (*NckRequestItem) SetSpecificationType ¶
func (n *NckRequestItem) SetSpecificationType(b byte)
func (*NckRequestItem) SetSyntaxId ¶
func (n *NckRequestItem) SetSyntaxId(id common.SyntaxID)
func (*NckRequestItem) ToBytes ¶
func (n *NckRequestItem) ToBytes() []byte
type PDU ¶
type PDU struct { TPKT common.TPKT COTP common.COTP Header common.Header Parameter common.Parameter Datum common.Datum }
func DataFromBytes ¶
func NewBlockInfo ¶
func NewBlockInfo(bt common.BlockType, dfs common.DestinationFileSystem, bn int, requestId uint16) *PDU
NewBlockInfo 查询块信息
func NewBlockListType ¶
NewBlockListType 查询块列表类型
func NewConnectDt ¶
NewConnectDt 创建连接setup
func NewConnectRequest ¶
NewConnectRequest 创建连接请求
func NewDownload ¶
func NewDownload(bt common.BlockType, dfs common.DestinationFileSystem, bn int, moreDataFollowing bool, bytes []byte, requestId uint16) *PDU
NewDownload 创建下载中
func NewEndDownload ¶
func NewEndDownload(bt common.BlockType, dfs common.DestinationFileSystem, bn int, requestId uint16) *PDU
NewEndDownload 创建结束下载
func NewInsert ¶
func NewInsert(bt common.BlockType, dfs common.DestinationFileSystem, bn int, requestId uint16) *PDU
NewInsert 创建插入文件指令
func NewReadRequest ¶
func NewReadRequest(items []common.RequestItem, requestId uint16) *PDU
NewReadRequest 创建默认读对象
func NewReadSzl ¶
NewReadSzl 读取szl
func NewStartDownload ¶
func NewStartDownload(bt common.BlockType, dfs common.DestinationFileSystem, bn int, loadMemoryLength int, mcCodeLength int, requestId uint16) *PDU
NewStartDownload 创建开始下载
func NewStartUpload ¶
func NewStartUpload(bt common.BlockType, dfs common.DestinationFileSystem, bn int, requestId uint16) *PDU
NewStartUpload 创建开始上传
func NewWriteRequest ¶
func NewWriteRequest(reqItems []common.RequestItem, dateItems []common.ResponseItem, requestId uint16) *PDU
NewWriteRequest 创建默认写对象
func (*PDU) GetParameter ¶
type PlcControlAckParameter ¶
type PlcControlAckParameter struct { // FunctionCode 功能码 // 字节大小:1 // 字节序数:0 FunctionCode common.FunctionCode // UnknownByte 未知字节 // 字节大小:1 // 字节序数:1 UnknownByte byte }
func NewPlcControlAckParameter ¶
func NewPlcControlAckParameter() *PlcControlAckParameter
func PlcControlAckParameterFromBytes ¶
func PlcControlAckParameterFromBytes(bytes []byte) (*PlcControlAckParameter, error)
func (*PlcControlAckParameter) Len ¶
func (p *PlcControlAckParameter) Len() int
func (*PlcControlAckParameter) ToBytes ¶
func (p *PlcControlAckParameter) ToBytes() []byte
type PlcControlInsertParamBlock ¶
type PlcControlInsertParamBlock struct { // UnknownByte 未知字节,固定0x00 UnknownByte byte // FileNames 文件名 FileNames []string }
PlcControlInsertParamBlock PLC控制参数块,插入功能
func NewPlcControlInsertParamBlock ¶
func NewPlcControlInsertParamBlock(filenames []string) *PlcControlInsertParamBlock
func (*PlcControlInsertParamBlock) Len ¶
func (p *PlcControlInsertParamBlock) Len() int
func (*PlcControlInsertParamBlock) ToBytes ¶
func (p *PlcControlInsertParamBlock) ToBytes() []byte
type PlcControlParameter ¶
type PlcControlParameter struct { // FunctionCode 功能码 // 字节大小:1 // 字节序数:0 FunctionCode common.FunctionCode // UnknownBytes 未知字节,固定参数 // 字节大小:7 // 字节序数:1-7 UnknownBytes []byte // ParameterBlockLength 参数块长度 // 字节大小:2 // 字节序数:8-9 ParameterBlockLength uint16 // ParameterBlock 参数块内容 ParameterBlock common.PlcControlParamBlock // LengthPart 服务名长度,后续字节长度,不包含自身 LengthPart uint8 // PiService 程序调用的服务名 PiService string }
PlcControlParameter 启动参数
func NewColdRestartPlcControlParameter ¶
func NewColdRestartPlcControlParameter() *PlcControlParameter
NewColdRestartPlcControlParameter 冷启动
func NewCompressPlcControlParameter ¶
func NewCompressPlcControlParameter() *PlcControlParameter
NewCompressPlcControlParameter 压缩
func NewCopyRamToRomPlcControlParameter ¶
func NewCopyRamToRomPlcControlParameter() *PlcControlParameter
NewCopyRamToRomPlcControlParameter 将ram复制到rom中
func NewHotRestartPlcControlParameter ¶
func NewHotRestartPlcControlParameter() *PlcControlParameter
NewHotRestartPlcControlParameter 热重启
func NewInsertPlcControlParameter ¶
func NewInsertPlcControlParameter(bt common.BlockType, bn int, dfs common.DestinationFileSystem) *PlcControlParameter
func PlcControlParameterFromBytes ¶
func PlcControlParameterFromBytes(bytes []byte) (*PlcControlParameter, error)
func (*PlcControlParameter) Len ¶
func (p *PlcControlParameter) Len() int
func (*PlcControlParameter) ToBytes ¶
func (p *PlcControlParameter) ToBytes() []byte
type PlcControlStringParamBlock ¶
type PlcControlStringParamBlock struct {
ParamBlock string
}
func NewPlcControlStringParamBlock ¶
func NewPlcControlStringParamBlock(paramBlock string) *PlcControlStringParamBlock
func (*PlcControlStringParamBlock) Len ¶
func (p *PlcControlStringParamBlock) Len() int
func (*PlcControlStringParamBlock) ToBytes ¶
func (p *PlcControlStringParamBlock) ToBytes() []byte
type PlcStopParameter ¶
type PlcStopParameter struct { // FunctionCode 功能码 // 字节大小:1 // 字节序数:0 FunctionCode common.FunctionCode // UnknownBytes 未知字节,固定参数 // 字节大小:5 // 字节序数:1-5 UnknownBytes []byte // LengthPart 服务名长度,后续字节长度,不包含自身 // 字节大小:1 // 字节序数:6 LengthPart uint8 // PiService 程序调用的服务名 PiService string }
func NewPlcStopParameter ¶
func NewPlcStopParameter() *PlcStopParameter
func PlcStopParameterFromBytes ¶
func PlcStopParameterFromBytes(bytes []byte) (*PlcStopParameter, error)
func (*PlcStopParameter) Len ¶
func (p *PlcStopParameter) Len() int
func (*PlcStopParameter) ToBytes ¶
func (p *PlcStopParameter) ToBytes() []byte
type ProtectionInfo ¶
type ProtectionInfo struct { Level uint16 ParameterLevel common.ParameterProtectionLevel CpuLevel common.CpuProtectionLevel SelectorSetting common.SelectorSetting StartupSwitch common.StartupSwitch }
ProtectionInfo protection info
func (ProtectionInfo) String ¶
func (c ProtectionInfo) String() string
type ReadSzlAckDatum ¶
type ReadSzlAckDatum struct { // ReturnCode 返回码 // 字节大小:1 // 字节序数:0 ReturnCode common.ReturnCode // VariableType 数据类型 // 字节大小:1 // 字节序数:1 VariableType common.DataVariableType // Length 长度 // 字节大小:2 // 字节序数:2-3 Length uint16 // Id szl id // 字节大小:2 // 字节序数:4-5 Id uint16 // Index szl index // 字节大小:2 // 字节序数:6-7 Index uint16 // PartLength 数据部分长度 // 字节大小:2 // 字节序数:8-9 PartLength uint16 // PartCount 数据部分数量 // 字节大小:2 // 字节序数:10-11 PartCount uint16 // Parts 数据部分 Parts [][]byte }
func ReadSzlAckDatumFromBytes ¶
func ReadSzlAckDatumFromBytes(bytes []byte) (*ReadSzlAckDatum, error)
func (*ReadSzlAckDatum) Len ¶
func (r *ReadSzlAckDatum) Len() int
func (*ReadSzlAckDatum) ToBytes ¶
func (r *ReadSzlAckDatum) ToBytes() []byte
type ReadSzlDatum ¶
type ReadSzlDatum struct { ReturnCode common.ReturnCode VariableType common.DataVariableType Length uint16 Id uint16 Index uint16 }
func NewReadSzlDatum ¶
func NewReadSzlDatum(szlId uint16, szlIndex uint16) *ReadSzlDatum
func (*ReadSzlDatum) Len ¶
func (r *ReadSzlDatum) Len() int
func (*ReadSzlDatum) ToBytes ¶
func (r *ReadSzlDatum) ToBytes() []byte
type ReadWriteDatum ¶
type ReadWriteDatum struct { // ReturnItems 数据项 ReturnItems []common.ResponseItem }
func NewReadWriteDatum ¶
func NewReadWriteDatum(items []common.ResponseItem) *ReadWriteDatum
func ReadWriteDatumFromBytes ¶
func ReadWriteDatumFromBytes(bytes []byte, messageType common.MessageType, functionCode common.FunctionCode) (*ReadWriteDatum, error)
func (*ReadWriteDatum) Len ¶
func (r *ReadWriteDatum) Len() int
func (*ReadWriteDatum) ToBytes ¶
func (r *ReadWriteDatum) ToBytes() []byte
type ReadWriteParameter ¶
type ReadWriteParameter struct { // FunctionCode 功能码 // 字节大小:1 // 字节序数:0 FunctionCode common.FunctionCode // ItemCount Request Item结构的数量 // 字节大小:1 // 字节序数:1 ItemCount uint8 // RequestItems 可重复的请求项 RequestItems []common.RequestItem }
func NewAckReadWriteParameter ¶
func NewAckReadWriteParameter(request *ReadWriteParameter) *ReadWriteParameter
func NewReqReadWriteParameter ¶
func NewReqReadWriteParameter(functionCode common.FunctionCode, items []common.RequestItem) *ReadWriteParameter
func ReadWriteParameterFromBytes ¶
func ReadWriteParameterFromBytes(bytes []byte) (*ReadWriteParameter, error)
func (*ReadWriteParameter) Len ¶
func (r *ReadWriteParameter) Len() int
func (*ReadWriteParameter) ToBytes ¶
func (r *ReadWriteParameter) ToBytes() []byte
type RequestHeader ¶
type RequestHeader struct { // ProtocolId 协议id // 字节大小:1 // 字节序数:0 ProtocolId byte // MessageType pdu(协议数据单元(Protocol Data Unit))的类型 // 字节大小:1 // 字节序数:1 MessageType common.MessageType // Reserved 保留 // 字节大小:2 // 字节序数:2-3 Reserved []byte // PduReference pdu的参考–由主站生成,每次新传输递增,大端 // 字节大小:2 // 字节序数:4-5 PduReference uint16 // ParameterLength 参数的长度(大端) // 字节大小:2 // 字节序数:6-7 ParameterLength uint16 // DataLength 数据的长度(大端) // 字节大小:2 // 字节序数:8-9 DataLength uint16 }
func NewRequestHeader ¶
func NewRequestHeader(requestId uint16) *RequestHeader
func NewUserDataHeader ¶
func NewUserDataHeader(requestId uint16) *RequestHeader
func RequestHeaderFromBytes ¶
func RequestHeaderFromBytes(bytes []byte) (*RequestHeader, error)
func (*RequestHeader) GetDataLength ¶
func (h *RequestHeader) GetDataLength() uint16
func (*RequestHeader) GetMessageType ¶
func (h *RequestHeader) GetMessageType() common.MessageType
func (*RequestHeader) GetParameterLength ¶
func (h *RequestHeader) GetParameterLength() uint16
func (*RequestHeader) GetPduReference ¶
func (h *RequestHeader) GetPduReference() uint16
func (*RequestHeader) GetProtocolId ¶
func (h *RequestHeader) GetProtocolId() byte
func (*RequestHeader) GetReserved ¶
func (h *RequestHeader) GetReserved() []byte
func (*RequestHeader) Len ¶
func (h *RequestHeader) Len() int
func (*RequestHeader) SetDataLength ¶
func (h *RequestHeader) SetDataLength(u uint16)
func (*RequestHeader) SetMessageType ¶
func (h *RequestHeader) SetMessageType(messageType common.MessageType)
func (*RequestHeader) SetParameterLength ¶
func (h *RequestHeader) SetParameterLength(u uint16)
func (*RequestHeader) SetPduReference ¶
func (h *RequestHeader) SetPduReference(u uint16)
func (*RequestHeader) SetProtocolId ¶
func (h *RequestHeader) SetProtocolId(b byte)
func (*RequestHeader) SetReserved ¶
func (h *RequestHeader) SetReserved(bytes []byte)
func (*RequestHeader) ToBytes ¶
func (h *RequestHeader) ToBytes() []byte
type ReturnItem ¶
type ReturnItem struct { // ReturnCode 返回码 // 字节大小:1 // 字节序数:0 ReturnCode common.ReturnCode }
func NewReturnItem ¶
func NewReturnItem(code common.ReturnCode) *ReturnItem
func ReturnItemFromBytes ¶
func ReturnItemFromBytes(bytes []byte) (*ReturnItem, error)
func (*ReturnItem) GetReturnCode ¶
func (r *ReturnItem) GetReturnCode() common.ReturnCode
func (*ReturnItem) Len ¶
func (r *ReturnItem) Len() int
func (*ReturnItem) SetReturnCode ¶
func (r *ReturnItem) SetReturnCode(code common.ReturnCode)
func (*ReturnItem) ToBytes ¶
func (r *ReturnItem) ToBytes() []byte
type SetPasswordDatum ¶
type SetPasswordDatum struct { // ReturnCode 返回码 // 字节大小:1 // 字节序数:0 ReturnCode common.ReturnCode // VariableType 数据类型 // 字节大小:1 // 字节序数:1 VariableType common.DataVariableType // Length 长度 // 字节大小:2 // 字节序数:2-3 Length uint16 // Password 密码 // 字节大小:8 // 字节序数:4-11 Password string }
func NewSetPasswordDatum ¶
func NewSetPasswordDatum(pwd string) *SetPasswordDatum
func (*SetPasswordDatum) Len ¶
func (s *SetPasswordDatum) Len() int
func (*SetPasswordDatum) ToBytes ¶
func (s *SetPasswordDatum) ToBytes() []byte
type SetupComParameter ¶
type SetupComParameter struct { // FunctionCode 功能码 // 字节大小:1 // 字节序数:0 FunctionCode common.FunctionCode // Reserved 预留 // 字节大小:1 // 字节序数:1 Reserved byte // MaxAmqCaller Ack队列的大小(主叫)(大端) // 字节大小:2 // 字节序数:2-3 MaxAmqCaller uint16 // MaxAmqCallee Ack队列的大小(被叫)(大端) // 字节大小:2 // 字节序数:4-5 MaxAmqCallee uint16 // PduLength PDU长度(大端) // 字节大小:2 // 字节序数:6-7 PduLength uint16 }
func NewSetupComParameter ¶
func NewSetupComParameter(pduLength uint16) *SetupComParameter
NewSetupComParameter 创建默认的设置通信参数,默认最大PDU长度240
func SetupComParameterFromBytes ¶
func SetupComParameterFromBytes(bytes []byte) (*SetupComParameter, error)
func (*SetupComParameter) Len ¶
func (s *SetupComParameter) Len() int
func (*SetupComParameter) ToBytes ¶
func (s *SetupComParameter) ToBytes() []byte
type StandardParameter ¶
type StandardParameter struct { // FunctionCode 功能码 // 字节大小:1 // 字节序数:0 FunctionCode common.FunctionCode }
func NewStandardParameter ¶
func NewStandardParameter(code common.FunctionCode) *StandardParameter
func (*StandardParameter) Len ¶
func (s *StandardParameter) Len() int
func (*StandardParameter) ToBytes ¶
func (s *StandardParameter) ToBytes() []byte
type StandardRequestItem ¶
type StandardRequestItem struct { // SpecificationType 变量规范 // 对于读/写消息,它总是具有值0x12 // 字节大小:1 // 字节序数:0 SpecificationType byte // LengthOfFollowing 其余部分的长度规范 // 字节大小:1 // 字节序数:1 LengthOfFollowing byte // SyntaxId 寻址模式和项结构其余部分的格式,它具有任意类型寻址的常量值0x10 // 字节大小:1 // 字节序数:2 SyntaxId common.SyntaxID // VariableType 变量的类型和长度BIT,BYTE,WORD,DWORD,COUNTER // 字节大小:1 // 字节序数:3 VariableType common.ParamVariableType // Count 读取长度 // 字节大小:2 // 字节序数:4-5 Count uint16 // DbNumber DB编号 // 如果访问的不是DB区域,此处为0x0000 // 字节大小:2 // 字节序数:6-7 DbNumber uint16 // Area 存储区类型 // 字节大小:1 // 字节序数:8 Area common.AreaType // ByteAddress 字节地址 // 位于开始字节地址address中3个字节,从第4位开始计数 // 字节大小:3 // 字节序数:9-11 ByteAddress int // BitAddress 位地址 // 位于开始字节地址address中3个字节的最后3位 BitAddress int }
func NewStandardRequestItem ¶
func NewStandardRequestItem(area common.AreaType, dbNumber int, variableType common.ParamVariableType, byteAddress int, bitAddress int, count int) *StandardRequestItem
func StandardRequestItemFromBytes ¶
func StandardRequestItemFromBytes(bytes []byte) (*StandardRequestItem, error)
func StandardRequestItemFromBytesWithOffset ¶
func StandardRequestItemFromBytesWithOffset(bytes []byte, offset int) (*StandardRequestItem, error)
func (*StandardRequestItem) GetLengthOfFollowing ¶
func (s *StandardRequestItem) GetLengthOfFollowing() byte
func (*StandardRequestItem) GetSpecificationType ¶
func (s *StandardRequestItem) GetSpecificationType() byte
func (*StandardRequestItem) GetSyntaxId ¶
func (s *StandardRequestItem) GetSyntaxId() common.SyntaxID
func (*StandardRequestItem) Len ¶
func (s *StandardRequestItem) Len() int
func (*StandardRequestItem) SetLengthOfFollowing ¶
func (s *StandardRequestItem) SetLengthOfFollowing(b byte)
func (*StandardRequestItem) SetSpecificationType ¶
func (s *StandardRequestItem) SetSpecificationType(b byte)
func (*StandardRequestItem) SetSyntaxId ¶
func (s *StandardRequestItem) SetSyntaxId(id common.SyntaxID)
func (*StandardRequestItem) ToBytes ¶
func (s *StandardRequestItem) ToBytes() []byte
type StartDownloadParameter ¶
type StartDownloadParameter struct { // FunctionCode 功能码 // 字节大小:1 // 字节序数:0 FunctionCode common.FunctionCode // MoreDataFollowing + ErrorStatus // 字节大小:1 // 字节序数:1 // MoreDataFollowing 后续是否还有更多数据 MoreDataFollowing bool // ErrorStatus 错误状态 ErrorStatus bool // ErrorCode 未知字节 // 字节大小:2 // 字节序数:2-3 ErrorCode []byte // Id 下载的Id,4个字节 // 字节大小:4 // 字节序数:4-7 Id uint32 // FileNameLength 文件名长度 // 字节大小:1 // 字节序数:8 FileNameLength uint8 // FileId 文件id // 字节大小:1 // 字节序数:9 FileId uint8 // BlockType 数据块类型 // 字节大小:2 // 字节序数:10-11 BlockType common.BlockType // BlockNumber 数据块编号,范围00000-99999 // 字节大小:5 // 字节序数:12-16 BlockNumber int // DestinationFileSystem 目标文件系统 // 字节大小:1 // 字节序数:17 DestinationFileSystem common.DestinationFileSystem // Part2Length 第二部分字符串长度 // 字节大小:1 // 字节序数:18 Part2Length uint8 // 未知字符 // 字节大小:1 // 字节序数:19 UnknownChar byte // 未知字符 // 字节大小:6 // 字节序数:20-25 LoadMemoryLength int // 未知字符 // 字节大小:6 // 字节序数:26-31 McCodeLength int }
func NewStartDownloadParameter ¶
func NewStartDownloadParameter(bt common.BlockType, dfs common.DestinationFileSystem, bn int, loadMemoryLength int, mcCodeLength int) *StartDownloadParameter
func StartDownloadParameterFromBytes ¶
func StartDownloadParameterFromBytes(bytes []byte) (*StartDownloadParameter, error)
func (*StartDownloadParameter) Len ¶
func (s *StartDownloadParameter) Len() int
func (*StartDownloadParameter) ToBytes ¶
func (s *StartDownloadParameter) ToBytes() []byte
type StartUploadAckParameter ¶
type StartUploadAckParameter struct { // FunctionCode 功能码 // 字节大小:1 // 字节序数:0 FunctionCode common.FunctionCode // MoreDataFollowing + ErrorStatus // 字节大小:1 // 字节序数:1 // MoreDataFollowing 后续是否还有更多数据 MoreDataFollowing bool // ErrorStatus 错误状态 ErrorStatus bool // ErrorCode 未知字节 // 字节大小:2 // 字节序数:2-3 ErrorCode []byte // Id 下载的Id,4个字节 // 字节大小:4 // 字节序数:4-7 Id uint32 // BlockLengthStringLength 即自此之后的数据长度 // 字节大小:1 // 字节序数:8 BlockLengthStringLength uint8 // BlockLength 到尾完整上传快的长度(以字节为单位) // 可以拆分为多个PDU // 字节大小:7 // 字节序数:9-15 BlockLength int }
func StartUploadAckParameterFromBytes ¶
func StartUploadAckParameterFromBytes(bytes []byte) (*StartUploadAckParameter, error)
func (*StartUploadAckParameter) Len ¶
func (s *StartUploadAckParameter) Len() int
func (*StartUploadAckParameter) ToBytes ¶
func (s *StartUploadAckParameter) ToBytes() []byte
type StartUploadParameter ¶
type StartUploadParameter struct { // FunctionCode 功能码 // 字节大小:1 // 字节序数:0 FunctionCode common.FunctionCode // MoreDataFollowing + ErrorStatus // 字节大小:1 // 字节序数:1 // MoreDataFollowing 后续是否还有更多数据 MoreDataFollowing bool // ErrorStatus 错误状态 ErrorStatus bool // ErrorCode 未知字节 // 字节大小:2 // 字节序数:2-3 ErrorCode []byte // Id 下载的Id,4个字节 // 字节大小:4 // 字节序数:4-7 Id uint32 // FileNameLength 文件名长度 // 字节大小:1 // 字节序数:8 FileNameLength uint8 // FileId 文件id // 字节大小:1 // 字节序数:9 FileId uint8 // BlockType 数据块类型 // 字节大小:2 // 字节序数:10-11 BlockType common.BlockType // BlockNumber 数据块编号,范围00000-99999 // 字节大小:5 // 字节序数:12-16 BlockNumber int // DestinationFileSystem 目标文件系统 // 字节大小:1 // 字节序数:17 DestinationFileSystem common.DestinationFileSystem }
func NewStartUploadParameter ¶
func NewStartUploadParameter(bt common.BlockType, dfs common.DestinationFileSystem, blockNumber int) *StartUploadParameter
func StartUploadParameterFromBytes ¶
func StartUploadParameterFromBytes(bytes []byte) (*StartUploadParameter, error)
func (*StartUploadParameter) Len ¶
func (s *StartUploadParameter) Len() int
func (*StartUploadParameter) ToBytes ¶
func (s *StartUploadParameter) ToBytes() []byte
type TPKT ¶
type TPKT struct { // Version 版本号,常量0x03 <br> // 字节大小:1 // 字节序数:0 Version byte // Reserved 预留,默认值0x00 // 字节大小:1 // 字节序数:1 Reserved byte // Length 长度,包括后面负载payload+版本号+预留+长度 // 字节大小:2 // 字节序数:2-3 Length uint16 }
func TPKTFromBytes ¶
func (*TPKT) GetReserved ¶
func (*TPKT) GetVersion ¶
func (*TPKT) SetReserved ¶
func (*TPKT) SetVersion ¶
type UnitInfo ¶
type UnitInfo struct { ModuleTypeName string SerialNumber string ASName string Copyright string ModuleName string }
UnitInfo unit info
type UpDownloadDatum ¶
type UpDownloadDatum struct { // Reserved 保留 // 字节大小:2 // 字节序数:0-1 Reserved []byte // Length 长度 // 字节大小:2 // 字节序数:2-3 Length uint16 // UnkonwnBytes 未知 // 字节大小:2 // 字节序数:4-5 UnkonwnBytes []byte // Data 数据部分 Data []byte }
func NewUpDownloadDatum ¶
func NewUpDownloadDatum(bytes []byte) *UpDownloadDatum
func UpDownloadDatumFromBytes ¶
func UpDownloadDatumFromBytes(bytes []byte) (*UpDownloadDatum, error)
func (*UpDownloadDatum) Len ¶
func (u *UpDownloadDatum) Len() int
func (*UpDownloadDatum) ToBytes ¶
func (u *UpDownloadDatum) ToBytes() []byte
type UploadAckParameter ¶
type UploadAckParameter struct { // FunctionCode 功能码 // 字节大小:1 // 字节序数:0 FunctionCode common.FunctionCode // MoreDataFollowing + ErrorStatus // 字节大小:1 // 字节序数:1 // MoreDataFollowing 后续是否还有更多数据 MoreDataFollowing bool // ErrorStatus 错误状态 ErrorStatus bool }
func NewUploadAckParameter ¶
func NewUploadAckParameter() *UploadAckParameter
func UploadAckParameterFromBytes ¶
func UploadAckParameterFromBytes(bytes []byte) (*UploadAckParameter, error)
func (*UploadAckParameter) Len ¶
func (u *UploadAckParameter) Len() int
func (*UploadAckParameter) ToBytes ¶
func (u *UploadAckParameter) ToBytes() []byte
type UploadParameter ¶
type UploadParameter struct { // FunctionCode 功能码 // 字节大小:1 // 字节序数:0 FunctionCode common.FunctionCode // MoreDataFollowing + ErrorStatus // 字节大小:1 // 字节序数:1 // MoreDataFollowing 后续是否还有更多数据 MoreDataFollowing bool // ErrorStatus 错误状态 ErrorStatus bool // ErrorCode 未知字节 // 字节大小:2 // 字节序数:2-3 ErrorCode []byte // Id 下载的Id,4个字节 // 字节大小:4 // 字节序数:4-7 Id uint32 }
func NewUploadParameter ¶
func NewUploadParameter(id uint32) *UploadParameter
func UploadParameterFromBytes ¶
func UploadParameterFromBytes(bytes []byte) (*UploadParameter, error)
func (*UploadParameter) Len ¶
func (u *UploadParameter) Len() int
func (*UploadParameter) ToBytes ¶
func (u *UploadParameter) ToBytes() []byte
type UserdataAckParameter ¶
type UserdataAckParameter struct { // Header 参数头 固定0x000112 // 字节大小:3 // 字节序数:0-2 Header []byte // ParameterLength 即自此之后参数长度 // 字节大小:1 // 字节序数:3 ParameterLength uint8 // Method 方法(request/response) // 字节大小:1 // 字节序数:4 Method common.Method // Type 类型 // 字节大小: 1 // 字节序数: 5 Type common.FunctionGroup // SubFunction 请求子方法 // 字节大小: 1 // 字节序数: 6 SubFunction byte // Sequence 顺序 // 字节大小: 1 // 字节序数: 7 Sequence uint8 // TpduNumber TPDU编号 // 字节大小:1,后面7位 // 字节序数:8 TpduNumber byte // LastDataUnit 是否最后一个数据单元 // 字节大小:1,最高位,7位 // 字节序数:9 LastDataUnit byte // ErrorClass 错误类型 // 字节大小:1 // 字节序数:10 ErrorClass byte // ErrorCode 错误码 // 本来是1个字节的,但本质上errorCode(真正) = errorClass + errorCode(原) // 字节大小:2 // 字节序数:10-11 ErrorCode []byte }
func UserdataAckParameterFromBytes ¶
func UserdataAckParameterFromBytes(bytes []byte) (*UserdataAckParameter, error)
func (*UserdataAckParameter) Len ¶
func (u *UserdataAckParameter) Len() int
func (*UserdataAckParameter) ToBytes ¶
func (u *UserdataAckParameter) ToBytes() []byte
type UserdataDatum ¶
type UserdataDatum struct { // ReturnCode 返回码 // 字节大小:1 // 字节序数:0 ReturnCode common.ReturnCode // VariableType 数据类型 // 字节大小:1 // 字节序数:1 VariableType common.DataVariableType // Length 长度 // 字节大小:2 // 字节序数:2-3 Length uint16 }
func NewUserdataDatum ¶
func NewUserdataDatum() *UserdataDatum
func UserdataDatumFromBytes ¶
func UserdataDatumFromBytes(bytes []byte) (*UserdataDatum, error)
func (*UserdataDatum) Len ¶
func (c *UserdataDatum) Len() int
func (*UserdataDatum) ToBytes ¶
func (c *UserdataDatum) ToBytes() []byte
type UserdataParameter ¶
type UserdataParameter struct { // Header 参数头 固定0x000112 // 字节大小:3 // 字节序数:0-2 Header []byte // ParameterLength 即自此之后参数长度 // 字节大小:1 // 字节序数:3 ParameterLength uint8 // Method 方法(request/response) // 字节大小:1 // 字节序数:4 Method common.Method // Type 类型 // 字节大小: 1 // 字节序数: 5 Type common.FunctionGroup // SubFunction 请求子方法 // 字节大小: 1 // 字节序数: 6 SubFunction byte // Sequence 顺序 // 字节大小: 1 // 字节序数: 7 Sequence uint8 }
func NewBlockParameter ¶
func NewBlockParameter(function common.BlockSubFunction) *UserdataParameter
func NewClockParameter ¶
func NewClockParameter(function common.TimeSubFunction) *UserdataParameter
func NewCpuParameter ¶
func NewCpuParameter(function common.CpuSubFunction) *UserdataParameter
func NewSecurityParameter ¶
func NewSecurityParameter(function common.SecuritySubFunction) *UserdataParameter
func UserdataParameterFromBytes ¶
func UserdataParameterFromBytes(bytes []byte) (*UserdataParameter, error)
func (*UserdataParameter) Len ¶
func (r *UserdataParameter) Len() int
func (*UserdataParameter) ToBytes ¶
func (r *UserdataParameter) ToBytes() []byte