Documentation
¶
Index ¶
- func RunCommandAsync(logger *zap.Logger, name string, args ...string)
- type Plugin
- type Registry
- func (r *Registry) All() []Plugin
- func (r *Registry) Capabilities() (incoming []string, outgoing []string)
- func (r *Registry) Dispatch(ctx context.Context, dev device.Sender, pkt *protocol.Packet)
- func (r *Registry) GetByName(name string) (Plugin, bool)
- func (r *Registry) OnConnect(dev device.Sender)
- func (r *Registry) OnDisconnect(dev device.Sender)
- func (r *Registry) Register(p Plugin)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Plugin ¶
type Plugin interface {
// Name returns the unique human-readable name of the plugin (e.g. "Battery").
Name() string
// IncomingTypes returns a list of packet type strings this plugin handles.
IncomingTypes() []string
// OutgoingTypes returns a list of packet type strings this plugin may send.
OutgoingTypes() []string
// Timeout returns the maximum duration allowed for this plugin's Handle execution.
// Return 0 for no timeout (or a global default).
Timeout() time.Duration
// OnConnect is called when the device connects.
OnConnect(dev device.Sender)
// OnDisconnect is called when the device disconnects.
OnDisconnect(dev device.Sender)
Handle(ctx context.Context, dev device.Sender, pkt *protocol.Packet) error
}
Plugin represents a KDE Connect functionality module. Implementations must not import other plugins, and must not block in Handle.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry manages the set of active plugins and routes packets to them.
func NewRegistry ¶
NewRegistry creates a new plugin registry.
func (*Registry) Capabilities ¶
Capabilities returns the aggregated incoming and outgoing capabilities of all registered plugins, suitable for sending in an Identity packet.
func (*Registry) OnConnect ¶
OnConnect is called when a device connects. It calls OnConnect on all registered plugins.
func (*Registry) OnDisconnect ¶
OnDisconnect is called when a device disconnects. It calls OnDisconnect on all registered plugins.
Click to show internal directories.
Click to hide internal directories.