Documentation
¶
Index ¶
- func HandleRequest(conn net.Conn, req Request, manager *Manager)
- type BluetoothEvent
- type BluetoothState
- type BluezAgent
- func (a *BluezAgent) AuthorizeService(device dbus.ObjectPath, uuid string) *dbus.Error
- func (a *BluezAgent) Cancel() *dbus.Error
- func (a *BluezAgent) Close()
- func (a *BluezAgent) DisplayPasskey(device dbus.ObjectPath, passkey uint32, entered uint16) *dbus.Error
- func (a *BluezAgent) DisplayPinCode(device dbus.ObjectPath, pincode string) *dbus.Error
- func (a *BluezAgent) Introspect() (string, *dbus.Error)
- func (a *BluezAgent) Release() *dbus.Error
- func (a *BluezAgent) RequestAuthorization(device dbus.ObjectPath) *dbus.Error
- func (a *BluezAgent) RequestConfirmation(device dbus.ObjectPath, passkey uint32) *dbus.Error
- func (a *BluezAgent) RequestPasskey(device dbus.ObjectPath) (uint32, *dbus.Error)
- func (a *BluezAgent) RequestPinCode(device dbus.ObjectPath) (string, *dbus.Error)
- type Device
- type Manager
- func (m *Manager) CancelPairing(token string) error
- func (m *Manager) Close()
- func (m *Manager) ConnectDevice(devicePath string) error
- func (m *Manager) DisconnectDevice(devicePath string) error
- func (m *Manager) GetState() BluetoothState
- func (m *Manager) PairDevice(devicePath string) error
- func (m *Manager) RemoveDevice(devicePath string) error
- func (m *Manager) SetPowered(powered bool) error
- func (m *Manager) StartDiscovery() error
- func (m *Manager) StopDiscovery() error
- func (m *Manager) SubmitPairing(token string, secrets map[string]string, accept bool) error
- func (m *Manager) Subscribe(id string) chan BluetoothState
- func (m *Manager) SubscribePairing(id string) chan PairingPrompt
- func (m *Manager) TrustDevice(devicePath string, trusted bool) error
- func (m *Manager) Unsubscribe(id string)
- func (m *Manager) UnsubscribePairing(id string)
- type PairingPrompt
- type PromptBroker
- type PromptReply
- type PromptRequest
- type Request
- type SubscriptionBroker
- type SuccessResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BluetoothEvent ¶
type BluetoothEvent struct {
Type string `json:"type"`
Data BluetoothState `json:"data"`
}
type BluetoothState ¶
type BluezAgent ¶
type BluezAgent struct {
// contains filtered or unexported fields
}
func NewBluezAgent ¶
func NewBluezAgent(broker PromptBroker) (*BluezAgent, error)
func (*BluezAgent) AuthorizeService ¶
func (a *BluezAgent) AuthorizeService(device dbus.ObjectPath, uuid string) *dbus.Error
func (*BluezAgent) Cancel ¶
func (a *BluezAgent) Cancel() *dbus.Error
func (*BluezAgent) Close ¶
func (a *BluezAgent) Close()
func (*BluezAgent) DisplayPasskey ¶
func (a *BluezAgent) DisplayPasskey(device dbus.ObjectPath, passkey uint32, entered uint16) *dbus.Error
func (*BluezAgent) DisplayPinCode ¶
func (a *BluezAgent) DisplayPinCode(device dbus.ObjectPath, pincode string) *dbus.Error
func (*BluezAgent) Introspect ¶
func (a *BluezAgent) Introspect() (string, *dbus.Error)
func (*BluezAgent) Release ¶
func (a *BluezAgent) Release() *dbus.Error
func (*BluezAgent) RequestAuthorization ¶
func (a *BluezAgent) RequestAuthorization(device dbus.ObjectPath) *dbus.Error
func (*BluezAgent) RequestConfirmation ¶
func (a *BluezAgent) RequestConfirmation(device dbus.ObjectPath, passkey uint32) *dbus.Error
func (*BluezAgent) RequestPasskey ¶
func (a *BluezAgent) RequestPasskey(device dbus.ObjectPath) (uint32, *dbus.Error)
func (*BluezAgent) RequestPinCode ¶
func (a *BluezAgent) RequestPinCode(device dbus.ObjectPath) (string, *dbus.Error)
type Device ¶
type Device struct {
Path string `json:"path"`
Address string `json:"address"`
Name string `json:"name"`
Alias string `json:"alias"`
Paired bool `json:"paired"`
Trusted bool `json:"trusted"`
Blocked bool `json:"blocked"`
Connected bool `json:"connected"`
Class uint32 `json:"class"`
Icon string `json:"icon"`
RSSI int16 `json:"rssi"`
LegacyPairing bool `json:"legacyPairing"`
}
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func (*Manager) CancelPairing ¶
func (*Manager) ConnectDevice ¶
func (*Manager) DisconnectDevice ¶
func (*Manager) GetState ¶
func (m *Manager) GetState() BluetoothState
func (*Manager) PairDevice ¶
func (*Manager) RemoveDevice ¶
func (*Manager) SetPowered ¶
func (*Manager) StartDiscovery ¶
func (*Manager) StopDiscovery ¶
func (*Manager) SubmitPairing ¶
func (*Manager) Subscribe ¶
func (m *Manager) Subscribe(id string) chan BluetoothState
func (*Manager) SubscribePairing ¶
func (m *Manager) SubscribePairing(id string) chan PairingPrompt
func (*Manager) Unsubscribe ¶
func (*Manager) UnsubscribePairing ¶
type PairingPrompt ¶
type PairingPrompt struct {
Token string `json:"token"`
DevicePath string `json:"devicePath"`
DeviceName string `json:"deviceName"`
DeviceAddr string `json:"deviceAddr"`
RequestType string `json:"requestType"`
Fields []string `json:"fields"`
Hints []string `json:"hints"`
Passkey *uint32 `json:"passkey,omitempty"`
}
type PromptBroker ¶
type PromptBroker interface {
Ask(ctx context.Context, req PromptRequest) (token string, err error)
Wait(ctx context.Context, token string) (PromptReply, error)
Resolve(token string, reply PromptReply) error
}
func NewSubscriptionBroker ¶
func NewSubscriptionBroker(broadcastPrompt func(PairingPrompt)) PromptBroker
type PromptReply ¶
type PromptRequest ¶
type SubscriptionBroker ¶
type SubscriptionBroker struct {
// contains filtered or unexported fields
}
func (*SubscriptionBroker) Ask ¶
func (b *SubscriptionBroker) Ask(ctx context.Context, req PromptRequest) (string, error)
func (*SubscriptionBroker) Resolve ¶
func (b *SubscriptionBroker) Resolve(token string, reply PromptReply) error
func (*SubscriptionBroker) Wait ¶
func (b *SubscriptionBroker) Wait(ctx context.Context, token string) (PromptReply, error)
type SuccessResult ¶
Click to show internal directories.
Click to hide internal directories.