prod_line

package
v0.0.19 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

README

雷管产线交互协议(融硅标准)

Documentation

Index

Constants

View Source
const (
	CmdCommunicateReq  = 0xFE
	CmdCommunicateResp = 0xFF

	CmdStartReq  = 0xB0
	CmdResp      = 0xF0
	CmdRecodeReq = 0xBA

	CmdCheckResp    = 0xE0
	CmdCodingResult = 0xE1
	CmdCodeReq      = 0xB1
	CmdLaserReq     = 0xB2
)

Variables

View Source
var (
	CommunicateErr = errors.New("Serial error")
)
View Source
var (
	ErrCommunication = errors.New("communication error")
)

Functions

func BuildPacket added in v0.0.5

func BuildPacket(cmd byte, body []byte) (packet []byte)

func Crc added in v0.0.3

func Crc(payload []byte) (crc byte)

func NewPacketProcessor added in v0.0.4

func NewPacketProcessor() (pp stream.PacketProcessor)

Types

type CheckItem

type CheckItem struct {
	ChannelId byte
	Uid       string
	Result    byte // type
}

type CheckResult

type CheckResult struct {
	Items []CheckItem
}

type CodingItem

type CodingItem struct {
	ChannelId     byte   // 通道
	DetonatorCode string // 管壳码
	Platform      byte   // 监管平台
	Permission    byte   // 许可
	Segment       []byte //段别
	Delay         []byte // 延期
	Result        byte   // type
}

type CodingResult

type CodingResult struct {
	LineLength []byte
	Items      []CodingItem
}

type ProductionLine

type ProductionLine struct {
}

type ProductionLinePacketProcessor added in v0.0.4

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

func (*ProductionLinePacketProcessor) Data added in v0.0.4

func (ppp *ProductionLinePacketProcessor) Data(payload []byte) (n int)

func (*ProductionLinePacketProcessor) Listen added in v0.0.4

func (ppp *ProductionLinePacketProcessor) Listen(onPacket func(p []byte))

type Sdk

type Sdk interface {
	OnProcessStart(h func())

	OnCheckConfirm(h func())
	CheckReply(cr CheckResult) (err error)

	Coding(h func())
	Recoding(h func())
	CodingReply(cr CodingResult) (err error)
	OnCodingResultConfirm(h func())

	OnProcessComplete(h func(result bool))
}

func New

func New(ctx context.Context, portName string, baud int) (s Sdk, err error)

Jump to

Keyboard shortcuts

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