events

package module
v0.0.0-...-8ef8425 Latest Latest
Warning

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

Go to latest
Published: May 14, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

README

go-unity-events

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandReceiver

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

func NewCommandReceiver

func NewCommandReceiver(cfg Config) (*CommandReceiver, error)

func (*CommandReceiver) AddHandler

func (c *CommandReceiver) AddHandler(handler UnityCommandReceiver)

type CommandSender

type CommandSender struct {
	UnityCommandSender
	// contains filtered or unexported fields
}

func NewCommandSender

func NewCommandSender(cfg Config) (*CommandSender, error)

func (*CommandSender) Send

func (e *CommandSender) Send(cmd UnityCommand) error

type Config

type Config struct {
	ConsumerName string
	RabbitHost   string
	RabbitPort   int
	RabbitUser   string
	RabbitPass   string
	RabbitQueue  string
}

type EventType

type EventType string

type EventUnit

type EventUnit string

type Publisher

type Publisher struct {
	UnityEventPublisher
	// contains filtered or unexported fields
}

func NewPublisher

func NewPublisher(cfg Config) (*Publisher, error)

func (*Publisher) Publish

func (e *Publisher) Publish(event UnityEvent) error

type Subscriber

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

func NewSubscriber

func NewSubscriber(cfg Config) (*Subscriber, error)

func (*Subscriber) AddHandler

func (s *Subscriber) AddHandler(handler UnityEventReceiver)

type UnityCommand

type UnityCommand struct {
	DeviceId string `json:"d"`
	State    string `json:"s"`
	Value    string `json:"v"`
	Target   string `json:"t"`
}

type UnityCommandReceiver

type UnityCommandReceiver func(event UnityCommand)

type UnityCommandSender

type UnityCommandSender interface {
	Send(cmd UnityCommand)
}

type UnityCommandSubscriber

type UnityCommandSubscriber interface {
	Receiver() error
	AddHandler(handler UnityCommandReceiver)
}

type UnityEvent

type UnityEvent struct {
	DeviceId  string    `json:"d"`
	EventType EventType `json:"e"`
	Timestamp int64     `json:"t"`
	Units     EventUnit `json:"u"`
	Value     string    `json:"v"`
}

type UnityEventPublisher

type UnityEventPublisher interface {
	Publish(event UnityEvent) error
}

type UnityEventReceiver

type UnityEventReceiver func(event UnityEvent)

type UnityEventSubscriber

type UnityEventSubscriber interface {
	Subscriber() error
	AddHandler(handler UnityEventReceiver)
}

Jump to

Keyboard shortcuts

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