Documentation ¶
Overview ¶
BlueZ D-Bus Agent API description [agent-api.txt]
Index ¶
- Constants
- Variables
- func ExposeAgent(conn *dbus.Conn, ag Agent1Client, caps string, setAsDefaultAgent bool) error
- func RemoveAgent(ag Agent1Client) error
- func SetTrusted(adapterID string, devicePath dbus.ObjectPath) error
- type Agent1
- func (a *Agent1) AuthorizeService(device dbus.ObjectPath, uuid string) error
- func (a *Agent1) Cancel() error
- func (a *Agent1) Client() *bluez.Client
- func (a *Agent1) Close()
- func (a *Agent1) DisplayPasskey(device dbus.ObjectPath, passkey uint32, entered uint16) error
- func (a *Agent1) DisplayPinCode(device dbus.ObjectPath, pincode string) error
- func (a *Agent1) GetObjectManagerSignal() (chan *dbus.Signal, func(), error)
- func (a *Agent1) Interface() string
- func (a *Agent1) Path() dbus.ObjectPath
- func (a *Agent1) Release() error
- func (a *Agent1) RequestAuthorization(device dbus.ObjectPath) error
- func (a *Agent1) RequestConfirmation(device dbus.ObjectPath, passkey uint32) error
- func (a *Agent1) RequestPasskey(device dbus.ObjectPath) (uint32, error)
- func (a *Agent1) RequestPinCode(device dbus.ObjectPath) (string, error)
- type Agent1Client
- type Agent1Properties
- type AgentManager1
- func (a *AgentManager1) Client() *bluez.Client
- func (a *AgentManager1) Close()
- func (a *AgentManager1) GetObjectManagerSignal() (chan *dbus.Signal, func(), error)
- func (a *AgentManager1) Interface() string
- func (a *AgentManager1) Path() dbus.ObjectPath
- func (a *AgentManager1) RegisterAgent(agent dbus.ObjectPath, capability string) error
- func (a *AgentManager1) RequestDefaultAgent(agent dbus.ObjectPath) error
- func (a *AgentManager1) UnregisterAgent(agent dbus.ObjectPath) error
- type AgentManager1Properties
- type SimpleAgent
- func (self *SimpleAgent) AuthorizeService(device dbus.ObjectPath, uuid string) *dbus.Error
- func (self *SimpleAgent) Cancel() *dbus.Error
- func (self *SimpleAgent) DisplayPasskey(device dbus.ObjectPath, passkey uint32, entered uint16) *dbus.Error
- func (self *SimpleAgent) DisplayPinCode(device dbus.ObjectPath, pincode string) *dbus.Error
- func (self *SimpleAgent) Interface() string
- func (self *SimpleAgent) PassCode() string
- func (self *SimpleAgent) PassKey() uint32
- func (self *SimpleAgent) Path() dbus.ObjectPath
- func (self *SimpleAgent) Release() *dbus.Error
- func (self *SimpleAgent) RequestAuthorization(device dbus.ObjectPath) *dbus.Error
- func (self *SimpleAgent) RequestConfirmation(path dbus.ObjectPath, passkey uint32) *dbus.Error
- func (self *SimpleAgent) RequestPasskey(path dbus.ObjectPath) (uint32, *dbus.Error)
- func (self *SimpleAgent) RequestPinCode(path dbus.ObjectPath) (string, *dbus.Error)
- func (self *SimpleAgent) SetPassCode(pinCode string)
- func (self *SimpleAgent) SetPassKey(passkey uint32)
Constants ¶
const ( CapDisplayOnly = "DisplayOnly" CapDisplayYesNo = "DisplayYesNo" CapKeyboardOnly = "KeyboardOnly" CapNoInputNoOutput = "NoInputNoOutput" CapKeyboardDisplay = "KeyboardDisplay" )
All agent capabilities
const SimpleAgentPassKey uint32 = 1024
const SimpleAgentPinCode = "0000"
Variables ¶
var Agent1Interface = "org.bluez.Agent1"
var AgentManager1Interface = "org.bluez.AgentManager1"
Functions ¶
func ExposeAgent ¶
ExposeAgent expose an Agent1 implementation to DBus and set as default agent
func RemoveAgent ¶
func RemoveAgent(ag Agent1Client) error
RemoveAgent remove an Agent1 implementation from AgentManager1
func SetTrusted ¶
func SetTrusted(adapterID string, devicePath dbus.ObjectPath) error
SetTrusted lookup for a device by object path and set it to trusted
Types ¶
type Agent1 ¶
type Agent1 struct { Properties *Agent1Properties // contains filtered or unexported fields }
Agent1 Agent hierarchy
func NewAgent1 ¶
func NewAgent1(servicePath string, objectPath dbus.ObjectPath) (*Agent1, error)
NewAgent1 create a new instance of Agent1
Args: - servicePath: unique name - objectPath: freely definable
func (*Agent1) AuthorizeService ¶
func (a *Agent1) AuthorizeService(device dbus.ObjectPath, uuid string) error
AuthorizeService
This method gets called when the service daemon needs to authorize a connection/service request. Possible errors: org.bluez.Error.Rejected org.bluez.Error.Canceled
func (*Agent1) Cancel ¶
Cancel
This method gets called to indicate that the agent request failed before a reply was returned.
func (*Agent1) DisplayPasskey ¶
DisplayPasskey
This method gets called when the service daemon needs to display a passkey for an authentication. The entered parameter indicates the number of already typed keys on the remote side. An empty reply should be returned. When the passkey needs no longer to be displayed, the Cancel method of the agent will be called. During the pairing process this method might be called multiple times to update the entered value. Note that the passkey will always be a 6-digit number, so the display should be zero-padded at the start if the value contains less than 6 digits.
func (*Agent1) DisplayPinCode ¶
func (a *Agent1) DisplayPinCode(device dbus.ObjectPath, pincode string) error
DisplayPinCode
This method gets called when the service daemon needs to display a pincode for an authentication. An empty reply should be returned. When the pincode needs no longer to be displayed, the Cancel method of the agent will be called. This is used during the pairing process of keyboards that don't support Bluetooth 2.1 Secure Simple Pairing, in contrast to DisplayPasskey which is used for those that do. This method will only ever be called once since older keyboards do not support typing notification. Note that the PIN will always be a 6-digit number, zero-padded to 6 digits. This is for harmony with the later specification. Possible errors: org.bluez.Error.Rejected org.bluez.Error.Canceled
func (*Agent1) GetObjectManagerSignal ¶
GetObjectManagerSignal return a channel for receiving updates from the ObjectManager
func (*Agent1) Release ¶
Release
This method gets called when the service daemon unregisters the agent. An agent can use it to do cleanup tasks. There is no need to unregister the agent, because when this method gets called it has already been unregistered.
func (*Agent1) RequestAuthorization ¶
func (a *Agent1) RequestAuthorization(device dbus.ObjectPath) error
RequestAuthorization
This method gets called to request the user to authorize an incoming pairing attempt which would in other circumstances trigger the just-works model, or when the user plugged in a device that implements cable pairing. In the latter case, the device would not be connected to the adapter via Bluetooth yet. Possible errors: org.bluez.Error.Rejected org.bluez.Error.Canceled
func (*Agent1) RequestConfirmation ¶
func (a *Agent1) RequestConfirmation(device dbus.ObjectPath, passkey uint32) error
RequestConfirmation
This method gets called when the service daemon needs to confirm a passkey for an authentication. To confirm the value it should return an empty reply or an error in case the passkey is invalid. Note that the passkey will always be a 6-digit number, so the display should be zero-padded at the start if the value contains less than 6 digits. Possible errors: org.bluez.Error.Rejected org.bluez.Error.Canceled
func (*Agent1) RequestPasskey ¶
func (a *Agent1) RequestPasskey(device dbus.ObjectPath) (uint32, error)
RequestPasskey
This method gets called when the service daemon needs to get the passkey for an authentication. The return value should be a numeric value between 0-999999. Possible errors: org.bluez.Error.Rejected org.bluez.Error.Canceled
func (*Agent1) RequestPinCode ¶
func (a *Agent1) RequestPinCode(device dbus.ObjectPath) (string, error)
RequestPinCode
This method gets called when the service daemon needs to get the passkey for an authentication. The return value should be a string of 1-16 characters length. The string can be alphanumeric. Possible errors: org.bluez.Error.Rejected org.bluez.Error.Canceled
type Agent1Client ¶
type Agent1Client interface { Release() *dbus.Error // Callback doesn't trigger on unregister RequestPinCode(device dbus.ObjectPath) (pincode string, err *dbus.Error) // Triggers for pairing when SSP is off and cap != CAP_NO_INPUT_NO_OUTPUT DisplayPinCode(device dbus.ObjectPath, pincode string) *dbus.Error RequestPasskey(device dbus.ObjectPath) (passkey uint32, err *dbus.Error) // SSP on, toolz.AGENT_CAP_KEYBOARD_ONLY DisplayPasskey(device dbus.ObjectPath, passkey uint32, entered uint16) *dbus.Error RequestConfirmation(device dbus.ObjectPath, passkey uint32) *dbus.Error RequestAuthorization(device dbus.ObjectPath) *dbus.Error AuthorizeService(device dbus.ObjectPath, uuid string) *dbus.Error Cancel() *dbus.Error Path() dbus.ObjectPath Interface() string }
type Agent1Properties ¶
type Agent1Properties struct {
// contains filtered or unexported fields
}
Agent1Properties contains the exposed properties of an interface
type AgentManager1 ¶
type AgentManager1 struct { Properties *AgentManager1Properties // contains filtered or unexported fields }
AgentManager1 Agent Manager hierarchy
func NewAgentManager1 ¶
func NewAgentManager1() (*AgentManager1, error)
func (*AgentManager1) Client ¶
func (a *AgentManager1) Client() *bluez.Client
Client return AgentManager1 dbus client
func (*AgentManager1) GetObjectManagerSignal ¶
func (a *AgentManager1) GetObjectManagerSignal() (chan *dbus.Signal, func(), error)
GetObjectManagerSignal return a channel for receiving updates from the ObjectManager
func (*AgentManager1) Interface ¶
func (a *AgentManager1) Interface() string
Interface return AgentManager1 interface
func (*AgentManager1) Path ¶
func (a *AgentManager1) Path() dbus.ObjectPath
Path return AgentManager1 object path
func (*AgentManager1) RegisterAgent ¶
func (a *AgentManager1) RegisterAgent(agent dbus.ObjectPath, capability string) error
RegisterAgent
This registers an agent handler. The object path defines the path of the agent that will be called when user input is needed. Every application can register its own agent and for all actions triggered by that application its agent is used. It is not required by an application to register an agent. If an application does chooses to not register an agent, the default agent is used. This is on most cases a good idea. Only application like a pairing wizard should register their own agent. An application can only register one agent. Multiple agents per application is not supported. The capability parameter can have the values "DisplayOnly", "DisplayYesNo", "KeyboardOnly", "NoInputNoOutput" and "KeyboardDisplay" which reflects the input and output capabilities of the agent. If an empty string is used it will fallback to "KeyboardDisplay". Possible errors: org.bluez.Error.InvalidArguments org.bluez.Error.AlreadyExists
func (*AgentManager1) RequestDefaultAgent ¶
func (a *AgentManager1) RequestDefaultAgent(agent dbus.ObjectPath) error
RequestDefaultAgent
This requests is to make the application agent the default agent. The application is required to register an agent. Special permission might be required to become the default agent. Possible errors: org.bluez.Error.DoesNotExist
func (*AgentManager1) UnregisterAgent ¶
func (a *AgentManager1) UnregisterAgent(agent dbus.ObjectPath) error
UnregisterAgent
This unregisters the agent that has been previously registered. The object path parameter must match the same value that has been used on registration. Possible errors: org.bluez.Error.DoesNotExist
type AgentManager1Properties ¶
type AgentManager1Properties struct {
// contains filtered or unexported fields
}
AgentManager1Properties contains the exposed properties of an interface
func (*AgentManager1Properties) Lock ¶
func (p *AgentManager1Properties) Lock()
Lock access to properties
func (*AgentManager1Properties) Unlock ¶
func (p *AgentManager1Properties) Unlock()
Unlock access to properties
type SimpleAgent ¶
type SimpleAgent struct {
// contains filtered or unexported fields
}
SimpleAgent implement interface Agent1Client
func NewDefaultSimpleAgent ¶
func NewDefaultSimpleAgent() *SimpleAgent
NewDefaultSimpleAgent return a SimpleAgent instance with default pincode and passcode
func NewSimpleAgent ¶
func NewSimpleAgent() *SimpleAgent
NewSimpleAgent return a SimpleAgent instance
func (*SimpleAgent) AuthorizeService ¶
func (self *SimpleAgent) AuthorizeService(device dbus.ObjectPath, uuid string) *dbus.Error
func (*SimpleAgent) Cancel ¶
func (self *SimpleAgent) Cancel() *dbus.Error
func (*SimpleAgent) DisplayPasskey ¶
func (self *SimpleAgent) DisplayPasskey(device dbus.ObjectPath, passkey uint32, entered uint16) *dbus.Error
func (*SimpleAgent) DisplayPinCode ¶
func (self *SimpleAgent) DisplayPinCode(device dbus.ObjectPath, pincode string) *dbus.Error
func (*SimpleAgent) Interface ¶
func (self *SimpleAgent) Interface() string
func (*SimpleAgent) PassCode ¶
func (self *SimpleAgent) PassCode() string
func (*SimpleAgent) PassKey ¶
func (self *SimpleAgent) PassKey() uint32
func (*SimpleAgent) Path ¶
func (self *SimpleAgent) Path() dbus.ObjectPath
func (*SimpleAgent) Release ¶
func (self *SimpleAgent) Release() *dbus.Error
func (*SimpleAgent) RequestAuthorization ¶
func (self *SimpleAgent) RequestAuthorization(device dbus.ObjectPath) *dbus.Error
func (*SimpleAgent) RequestConfirmation ¶
func (self *SimpleAgent) RequestConfirmation(path dbus.ObjectPath, passkey uint32) *dbus.Error
func (*SimpleAgent) RequestPasskey ¶
func (self *SimpleAgent) RequestPasskey(path dbus.ObjectPath) (uint32, *dbus.Error)
func (*SimpleAgent) RequestPinCode ¶
func (self *SimpleAgent) RequestPinCode(path dbus.ObjectPath) (string, *dbus.Error)
func (*SimpleAgent) SetPassCode ¶
func (self *SimpleAgent) SetPassCode(pinCode string)
func (*SimpleAgent) SetPassKey ¶
func (self *SimpleAgent) SetPassKey(passkey uint32)