protocol

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message interface {
	SetCbor([]byte)
	Cbor() []byte
	Type() uint8
}

Provide a common interface for message utility functions

type MessageBase

type MessageBase struct {
	MessageType uint8
	// contains filtered or unexported fields
}

func (*MessageBase) Cbor

func (m *MessageBase) Cbor() []byte

func (*MessageBase) SetCbor

func (m *MessageBase) SetCbor(data []byte)

func (*MessageBase) Type

func (m *MessageBase) Type() uint8

type MessageFromCborFunc

type MessageFromCborFunc func(uint, []byte) (Message, error)

type MessageHandlerFunc

type MessageHandlerFunc func(Message) error

type Protocol

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

func New

func New(name string, protocolId uint16, m *muxer.Muxer, errorChan chan error, handlerFunc MessageHandlerFunc, msgFromCborFunc MessageFromCborFunc) *Protocol

func (*Protocol) GetState

func (p *Protocol) GetState() State

func (*Protocol) LockState added in v0.5.1

func (p *Protocol) LockState(allowedStates []State) error

func (*Protocol) SendMessage

func (p *Protocol) SendMessage(msg interface{}, isResponse bool) error

func (*Protocol) SetState

func (p *Protocol) SetState(state State)

func (*Protocol) UnlockState added in v0.5.1

func (p *Protocol) UnlockState(newState State)

type State added in v0.5.1

type State struct {
	Id   uint
	Name string
}

func NewState added in v0.5.1

func NewState(id uint, name string) State

func (State) String added in v0.5.1

func (s State) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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