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 ¶
- type Adapter
- type Method
- type SimuSource
- func (s *SimuSource) BroadcastMessage(msg core.Message)
- func (s *SimuSource) CollectProperties() (core.KWArgs, error)
- func (s *SimuSource) Invoke(name string, args core.Args) (core.Any, error)
- func (s *SimuSource) Linked(objectId string, node *remote.Node) error
- func (s *SimuSource) NotifyPropertyChanged(name string, value core.Any)
- func (s *SimuSource) NotifySignal(name string, args core.Args)
- func (s *SimuSource) ObjectId() string
- func (s *SimuSource) SetProperty(name string, value core.Any) error
- type SimuSourceOptions
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) SourceById ¶
func (a *Adapter) SourceById(objectId string) *SimuSource
SourceById returns a source by id.
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) 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 }