ship

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ShipRoleServer shipRole = "server"
	ShipRoleClient shipRole = "client"
)

Variables

This section is empty.

Functions

func JsonFromEEBUSJson

func JsonFromEEBUSJson(json []byte) []byte

convert incoming EEBUS json format into standard json format

func JsonIntoEEBUSJson

func JsonIntoEEBUSJson(data []byte) (string, error)

convert json into the EEBUS json format

Types

type ShipConnection

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

A ShipConnection handles the data connection and coordinates SHIP and SPINE messages i/o

func NewConnectionHandler

func NewConnectionHandler(
	dataProvider api.ShipConnectionInfoProviderInterface,
	dataHandler api.WebsocketDataWriterInterface,
	role shipRole,
	localShipID,
	remoteSki,
	remoteShipId string) *ShipConnection

func (*ShipConnection) AbortPendingHandshake

func (c *ShipConnection) AbortPendingHandshake()

invoked when pairing for a pending request is denied

func (*ShipConnection) ApprovePendingHandshake

func (c *ShipConnection) ApprovePendingHandshake()

invoked when pairing for a pending request is approved

func (*ShipConnection) CloseConnection

func (c *ShipConnection) CloseConnection(safe bool, code int, reason string)

close this ship connection

func (*ShipConnection) DataHandler

func (*ShipConnection) HandleIncomingWebsocketMessage

func (c *ShipConnection) HandleIncomingWebsocketMessage(message []byte)

route the incoming message to either SHIP or SPINE message handlers

func (*ShipConnection) RemoteSKI

func (c *ShipConnection) RemoteSKI() string

func (*ShipConnection) ReportConnectionError

func (c *ShipConnection) ReportConnectionError(err error)

the websocket data connection was closed from remote

func (*ShipConnection) Run

func (c *ShipConnection) Run()

start SHIP communication

func (*ShipConnection) ShipHandshakeState

func (c *ShipConnection) ShipHandshakeState() (model.ShipMessageExchangeState, error)

provides the current ship state and error value if the state is in error

func (*ShipConnection) WriteShipMessageWithPayload

func (c *ShipConnection) WriteShipMessageWithPayload(message []byte)

SpineDataConnection interface implementation

Jump to

Keyboard shortcuts

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