Documentation ¶
Index ¶
- Variables
- func DisplayMessage(name string, in, out *streamer.OutputMessage, w io.Writer, compact bool, ...) bool
- func NewMetaData(defaults ...MetaOption) map[string]any
- func SendAPIRequest(client *APIClient, host, method, path string, body any) (err error)
- func WithMQTTPublisher(client mqtt.Client, topic string, qos byte, retain bool, message any) func()
- func WithRESTRequest(client *APIClient, host, method, path string, message any) func()
- func WithSettings(opts ...SettingOption) string
- type APIClient
- type DefaultServiceOptions
- type Entity
- type EntityContent
- type EntityStore
- type MessageHandler
- type MetaOption
- type Service
- func (s *Service) ClearRoutes()
- func (s *Service) GetRoutes() []routes.Route
- func (s *Service) GetVariables() string
- func (s *Service) Register(topics []string, qos byte, handler MessageHandler) error
- func (s *Service) ScanMappingFiles(dirs []string) []routes.Route
- func (s *Service) StartSubscriptions() error
- type SettingOption
- type VariablesFactory
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoMQTTClient = errors.New("no mqtt client")
View Source
var TedgeBinary = "tedge"
Functions ¶
func DisplayMessage ¶
func NewMetaData ¶
func NewMetaData(defaults ...MetaOption) map[string]any
func SendAPIRequest ¶
func WithMQTTPublisher ¶
func WithRESTRequest ¶
func WithSettings ¶
func WithSettings(opts ...SettingOption) string
Types ¶
type DefaultServiceOptions ¶
type DefaultServiceOptions struct { Broker string ClientID string CleanSession bool HTTPEndpoint string RouteDirs []string MaxRouteDepth int PostMessageDelay time.Duration Debug bool DryRun bool MetaOptions []MetaOption LibraryPaths []string UseColor bool EntityFile string EnableRegistrationListener bool }
type EntityContent ¶
type EntityStore ¶
type EntityStore struct {
// contains filtered or unexported fields
}
func NewEntityStore ¶
func NewEntityStore() *EntityStore
func (*EntityStore) SerializedEntities ¶
func (s *EntityStore) SerializedEntities() []byte
func (*EntityStore) SetFromJSON ¶
func (s *EntityStore) SetFromJSON(content []byte, deleteExisting bool, ignoreErrors bool) error
Update multiple entities from json
type MessageHandler ¶
type MessageHandler func(topic string, message_in string) (message_out *streamer.OutputMessage, err error)
func NewStreamFactory ¶
func NewStreamFactory(client mqtt.Client, apiClient *APIClient, route routes.Route, variablesFactory VariablesFactory, maxDepth int, postDelay time.Duration, opts ...jsonnet.TemplateOption) MessageHandler
type MetaOption ¶
func WithMetaDefaultDeviceID ¶
func WithMetaDefaultDeviceID(value string) MetaOption
func WithMetaDefaultValue ¶
func WithMetaDefaultValue(key string, value any) MetaOption
func WithMetaHostname ¶
func WithMetaHostname() MetaOption
type Service ¶
type Service struct { Client mqtt.Client APIClient *APIClient Subscriptions map[string]byte Routes []routes.Route EntityStore *EntityStore }
func NewDefaultService ¶
func NewDefaultService(opts *DefaultServiceOptions) (*Service, error)
func NewService ¶
func (*Service) ClearRoutes ¶
func (s *Service) ClearRoutes()
func (*Service) GetVariables ¶
func (*Service) Register ¶
func (s *Service) Register(topics []string, qos byte, handler MessageHandler) error
func (*Service) ScanMappingFiles ¶
Scan for routes from a directory. It will automatically add routes to the existing list. Use an explicit call to ClearRoutes if you want to clear existing routes before calling this function. Note: Currently routes are not unregistered from the MQTT client. For this to occur the MQTT client needs to be stopped and destroyed.
func (*Service) StartSubscriptions ¶
type SettingOption ¶
type SettingOption func() string
func WithTedgeSetting ¶
func WithTedgeSetting(key string) SettingOption
Get a configuration value from thin-edge.io using the tedge cli
type VariablesFactory ¶
type VariablesFactory func() string
Click to show internal directories.
Click to hide internal directories.