terminal

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler interface {
	String() string
	Protocol() consts.JT808CommandType
	Encode() []byte
	Parse(jtMsg *jt808.JTMessage) error
	ReplyBody(jtMsg *jt808.JTMessage) ([]byte, error)
	ReplyProtocol() consts.JT808CommandType
}

type Option

type Option struct {
	F func(o *Options)
}

func WithCustomHeader

func WithCustomHeader(header *jt808.Header) Option

func WithCustomProtocolHandleFunc

func WithCustomProtocolHandleFunc(customFunc func() map[consts.JT808CommandType]Handler) Option

func WithHeader

func WithHeader(protocolVersion consts.ProtocolVersionType, phone string) Option

type Options

type Options struct {
	Header                   *jt808.Header
	CustomProtocolHandleFunc func() map[consts.JT808CommandType]Handler
}

func NewOptions

func NewOptions(opts []Option) *Options

func (*Options) Apply

func (o *Options) Apply(opts []Option)

type Terminal

type Terminal struct {
	TerminalPhoneNo string
	// contains filtered or unexported fields
}

func New

func New(opts ...Option) *Terminal

func (*Terminal) CreateDefaultCommandData

func (t *Terminal) CreateDefaultCommandData(commandType consts.JT808CommandType) []byte

func (*Terminal) ExpectedReply

func (t *Terminal) ExpectedReply(seq uint16, msg string) []byte

func (*Terminal) ProtocolDetails

func (t *Terminal) ProtocolDetails(msg string) string

Jump to

Keyboard shortcuts

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