ymodem

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SOH  byte = 0x01 // YModem协议的起始帧标志 128字节数据包
	STX  byte = 0x02 // YModem-1K协议的起始帧标志 1024字节数据包
	EOT  byte = 0x04 // 传输结束标志
	ACK  byte = 0x06 // 确认接收字符
	NAK  byte = 0x15 // 未确认接收字符
	CAN  byte = 0x18 // 取消传输字符
	POLL byte = 0x43 // 轮询字符,用于请求发送
)

定义YModem协议中的控制字符

Variables

View Source
var ErrDataTooLong = errors.New("data too long")

Functions

This section is empty.

Types

type Frame

type Frame struct {
	// contains filtered or unexported fields
}

func BuildDataFrames

func BuildDataFrames(fileData []byte) ([]*Frame, error)

BuildDataFrames 构造数据帧

func BuildEndFrame

func BuildEndFrame() (*Frame, error)

BuildEndFrame 构造结束帧

func BuildStartFrame

func BuildStartFrame(filename string, filesize int) (*Frame, error)

BuildStartFrame 构造起始帧

func NewFrame

func NewFrame(seq byte, data []byte) (*Frame, error)

NewFrame 构造数据帧

func (*Frame) Bytes

func (f *Frame) Bytes() []byte

Bytes 将帧转换为字节数组

Jump to

Keyboard shortcuts

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