olnk

package
v0.37.0 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Olink Adapter for Simulation

This package provides an adapter for simulation to be used with object-link. ObjectLink is a websocket based protocol for communication between client and server. A Hub on the server side is used to manage all connections and objects. ON each websocket connection a remote node is created. On a link message the node will be linked to the object. For this the object must be registered as a generic source. In case a source is not found the node will be linked to a default object. We set the default source for the registry to a generic object.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

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

Adapter is a object-link adapter for simulation.

func NewAdapter

func NewAdapter(simu *sim.Simulation, r *remote.Registry) *Adapter

func (*Adapter) CreateSource

func (a *Adapter) CreateSource(objectId string) *SimuSource

func (*Adapter) Registry

func (a *Adapter) Registry() *remote.Registry

func (*Adapter) SourceById

func (a *Adapter) SourceById(objectId string) *SimuSource

SourceById returns a source by id.

type Method

type Method func(args core.Args) (core.Any, error)

type SimuSource

type SimuSource struct {
	Id       string
	Registry *remote.Registry
	Simu     *sim.Simulation
}

SimuSource is a generic object-link source for simulation.

func NewSimuSource

func NewSimuSource(o SimuSourceOptions) *SimuSource

NewSimuSource creates a new SimuSource.

func (*SimuSource) BroadcastMessage

func (s *SimuSource) BroadcastMessage(msg core.Message)

BroadcastMessage broadcasts a message to all remote nodes.

func (*SimuSource) CollectProperties

func (s *SimuSource) CollectProperties() (core.KWArgs, error)

CollectProperties collects all properties of the source.

func (*SimuSource) Invoke

func (s *SimuSource) Invoke(name string, args core.Args) (core.Any, error)

Invoke invokes a method of the source.

func (*SimuSource) Linked

func (s *SimuSource) Linked(objectId string, node *remote.Node) error

Linked is called when the source is linked to a remote node.

func (*SimuSource) NotifyPropertyChanged

func (s *SimuSource) NotifyPropertyChanged(name string, value core.Any)

NotifyPropertyChanged notifies all listeners that a property is changed.

func (*SimuSource) NotifySignal

func (s *SimuSource) NotifySignal(name string, args core.Args)

NotifySignal notifies all listeners that a signal is emitted.

func (*SimuSource) ObjectId

func (s *SimuSource) ObjectId() string

ObjectId returns the id of the source.

func (*SimuSource) SetProperty

func (s *SimuSource) SetProperty(name string, value core.Any) error

SetProperty sets a property of the source.

type SimuSourceOptions

type SimuSourceOptions struct {
	ObjectId string
	Simu     *sim.Simulation
	Registry *remote.Registry
}

Jump to

Keyboard shortcuts

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