tbus

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2025 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NK2_KEEPALIVE        = []byte("HI")
	NK2_CONNECT_REQ      = []byte{0x50, 0x48, 0x4f, 0x45, 0x4e, 0x49, 0x58, 0x2d, 0x44, 0x42, 0x20, 0x4e, 0x0a}
	NK2_CONNECT_RESP     = []byte{0x57, 0x65, 0x6c, 0x63, 0x6f, 0x6d, 0x65, 0x0a}
	NK2_HEADER           = []byte{0x4e, 0x4b, 0x32}
	NK_STATUS_RESP       = []byte{0x05, 0x0B}
	NK_MULTI_STATUS_REQ  = []byte{0x50, 0x41, 0x53, 0x32, 0x00, 0x11, 0x4e, 0x4b, 0x32, 0x00, 0xfe, 0x02, 0x08, 0x00, 0x00, 0x00, 0x47, 0xff, 0xff, 0xff, 0xff, 0xc7, 0x08}
	NK_MULTI_STATUS_RESP = []byte{0x03, 0xe1}
)

Functions

This section is empty.

Types

type CrosspointRequest

type CrosspointRequest struct {
	Source      uint16
	Destination uint16
	Level       Level
	Address     TBusAddress
}

func (*CrosspointRequest) Packet

func (xpt *CrosspointRequest) Packet() ([]byte, error)

GenerateXPTRequest Just returns payload to send to router to close xpt

type Destination

type Destination = uint16

type Level

type Level = uint32

type RouteUpdate

type RouteUpdate struct {
	Destination int `json:"destination"`
	Source      int `json:"source"`
	Level       int `json:"level"`
}

type Source

type Source = uint16

type StatusUpdate

type StatusUpdate struct {
	Connected bool   `json:"connected"`
	Reason    string `json:"reason"`
}

type TBusAddress

type TBusAddress = uint8

type TBusCRC

type TBusCRC = uint16

type TBusGateway

type TBusGateway struct {
	IP net.IP
	// contains filtered or unexported fields
}

A IPS is an implementation of the protocol interface with the NK Routing system via an NK-NET or NK-IPS

func NewGateway

func NewGateway(ip net.IP, log zerolog.Logger, onRouteUpdate func(RouteUpdate), onStatusUpdate func(StatusUpdate)) *TBusGateway

func (*TBusGateway) Connect

func (tbus *TBusGateway) Connect(ctx context.Context) error

func (*TBusGateway) Disconnect

func (tbus *TBusGateway) Disconnect()

func (*TBusGateway) Route

func (tbus *TBusGateway) Route(address TBusAddress, level Level, destination uint16, source uint16) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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