Documentation
¶
Index ¶
Constants ¶
View Source
const ( // DefaultSubscriberCap is the channel buffer size for plugin-internal // subscribers (battery test waits, sftp credential waits, etc.). DefaultSubscriberCap = 64 // WatchSubscriberCap is the channel buffer for the kcd watch IPC stream. // Larger to tolerate slow CLI consumers (jq, SSH, slow terminals). WatchSubscriberCap = 256 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bus ¶
type Bus struct {
// contains filtered or unexported fields
}
Bus distributes events to multiple subscribers.
func (*Bus) Subscribe ¶
func (b *Bus) Subscribe(capacity int, filters ...EventType) *Subscriber
Subscribe returns a new subscriber that receives events matching the filters. capacity sets the channel buffer size; pass 0 or DefaultSubscriberCap for the standard 64-event buffer. If filters is empty, it receives all events.
type Event ¶
type Event struct {
Type EventType `json:"type"`
Timestamp time.Time `json:"timestamp"`
DeviceID string `json:"deviceId,omitempty"`
Payload any `json:"payload,omitempty"`
}
Event represents a single occurrence of something interesting in the daemon.
type EventType ¶
type EventType string
EventType defines the kind of event being broadcast.
const ( TypeDeviceAdded EventType = "device.added" TypeDeviceRemoved EventType = "device.removed" TypeDeviceConnected EventType = "device.connected" TypeDeviceDisconnected EventType = "device.disconnected" TypePairRequested EventType = "pair.requested" TypePairAccepted EventType = "pair.accepted" TypePairRejected EventType = "pair.rejected" TypeBatteryUpdate EventType = "battery.update" TypeBatteryThreshold EventType = "battery.threshold" TypeNotification EventType = "notification" TypePingReceived EventType = "ping.received" TypeTelephonyRinging EventType = "telephony.ringing" TypeTelephonyMissed EventType = "telephony.missed" TypeTelephonyTalking EventType = "telephony.talking" TypeTelephonyCanceled EventType = "telephony.canceled" TypeConnectivityUpdate EventType = "connectivity.update" TypeSftpMount EventType = "sftp.mount" TypeNotificationCanceled EventType = "notification.canceled" TypeVolumeUpdate EventType = "volume.update" TypeSMSIncoming EventType = "sms.incoming" TypeSMSAttachment EventType = "sms.attachment" TypeRingReceived EventType = "ring.received" TypeMprisUpdate EventType = "mpris.update" )
Known event types.
type Subscriber ¶
type Subscriber struct {
C <-chan Event
// contains filtered or unexported fields
}
Subscriber receives events.
Click to show internal directories.
Click to hide internal directories.