Documentation ¶
Index ¶
- Constants
- type Bluetooth
- type Client
- type HidProfile
- func (p *HidProfile) Close()
- func (p *HidProfile) Connection() chan *Client
- func (p *HidProfile) Disconnection() chan *Client
- func (p *HidProfile) Export() error
- func (p *HidProfile) NewConnection(dev dbus.ObjectPath, fd dbus.UnixFD, fdProps map[string]dbus.Variant) *dbus.Error
- func (p *HidProfile) Register(desc string) error
- func (p *HidProfile) Release() *dbus.Error
- func (p *HidProfile) RequestDisconnection(dev dbus.ObjectPath) *dbus.Error
- func (p *HidProfile) Unregister() error
- type Keyboard
Constants ¶
const ( PSMCTRL = 0x11 PSMINTR = 0x13 BUFSIZE = 1024 FDBITS = 32 )
const (
BTPROTO_L2CAP = 0
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bluetooth ¶
type Bluetooth struct {
// contains filtered or unexported fields
}
Bluetooth represents a bluetooth socket connection
func ListenBluetooth ¶
ListenBluetooth creates L2CAP socket and lets it listen on given PSM
func NewBluetoothSocket ¶
NewBluetoothSocket creates L2CAP socket wrapper with given file descriptor This file descriptor is provided by BlueZ DBus interface e.g. org.bluez.Profile1.NewConnection()
func (*Bluetooth) SetBlocking ¶
SetBlocking sets socket to blocking mode(true) or Non-blocking mode(false)
type Client ¶
type Client struct { Dev dbus.ObjectPath Sintr *Bluetooth Sctrl *Bluetooth Done chan struct{} }
Client represents a bluetooth client
type HidProfile ¶
type HidProfile struct {
// contains filtered or unexported fields
}
HidProfile represents a dbus profile for the keyboard
func NewHidProfile ¶
func NewHidProfile(path string) (*HidProfile, error)
NewHidProfile returns a new HidProfile on the given path
func (*HidProfile) Connection ¶
func (p *HidProfile) Connection() chan *Client
Connection returns a channel of new bluetooth connection
func (*HidProfile) Disconnection ¶
func (p *HidProfile) Disconnection() chan *Client
Disconnection is designed to returns a channel of disconnction requests, but currently it doesn't work
func (*HidProfile) NewConnection ¶
func (p *HidProfile) NewConnection(dev dbus.ObjectPath, fd dbus.UnixFD, fdProps map[string]dbus.Variant) *dbus.Error
NewConnection handles new bluetooth connections
func (*HidProfile) Register ¶
func (p *HidProfile) Register(desc string) error
Register registers the profile to dbus
func (*HidProfile) Release ¶
func (p *HidProfile) Release() *dbus.Error
Release is called when the profile is unregisterd
func (*HidProfile) RequestDisconnection ¶
func (p *HidProfile) RequestDisconnection(dev dbus.ObjectPath) *dbus.Error
RequestDisconnection ... I don't know how to use this yet
func (*HidProfile) Unregister ¶
func (p *HidProfile) Unregister() error
Unregister unregisters the profile from dbus
type Keyboard ¶
Keyboard represents a HID keyboard
func NewKeyboard ¶
NewKeyboard returns a new keyboard on the first usb keyboard connected.
func (*Keyboard) Connect ¶
Connect hooks up the given client with the usb keyboard, and start piping keypresses to the client. Will return an error if the keyboard is already in use
func (*Keyboard) Disconnect ¶
Disconnect closes the connection to the given bluetooth client Currently this is just some cleanning up. It can't close the actual bluetooth connection, and will block on the attempt TODO: Find a way to close the connection