Ravn::
Bluez module
Extended With |
|
Utility functions for interacting with the system bluetooth stack.
This requires the following system configuration in /etc/dbus-1/system.d/ravn.conf
:
<!DOCTYPE busconfig PUBLIC “-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN” “www.freedesktop.org/standards/dbus/1.0/busconfig.dtd”> <busconfig> <policy user=“ravn”> <allow own=“com.ravn.agent” /> </policy> <policy context=“default”> <allow send_destination=“com.ravn.agent” /> </policy> </busconfig>
Constants
- BLUEZ_ADAPTER_NS
Current namespace for the adapter service interface. github.com/bluez/bluez/blob/master/doc/adapter-api.txt
- BLUEZ_AGENTMANAGER_NS
Current namespace for the agent manager service interface. github.com/bluez/bluez/blob/master/doc/agent-api.txt
- BLUEZ_AGENT_NS
Current namespace for the agent service interface. github.com/bluez/bluez/blob/master/doc/agent-api.txt
- BLUEZ_DEVICE_NS
Current namespace for the device service interface. github.com/bluez/bluez/blob/master/doc/device-api.txt
- BLUEZ_OBJMANAGER_NS
Current namespace for the objectmanager interface. dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-objectmanager
- BLUEZ_PROFILEMANAGER_NS
Current namespace for the profile service interface. github.com/bluez/bluez/blob/master/doc/profile-api.txt
- PAIRING_AGENT_NS
The namespace for the
Ravn
pairing agent callback. (This requires dbus operating system configuration.)- PAIRING_AGENT_PATH
The path to the
Ravn
pairing agent callback. git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/agent-api.txt- SERIAL_DBUS_PATH
The DBus path of the serial agent profile.
- SPP_PROFILE_UUID
The (shortened) UUID of the SPP profile
Public Class Methods
Instantiate a new SerialProfile callback instance.
Public Instance Methods
Return a memoized service interface for the bluetooth adapter, setting up any configuration on first instantiation.
Return the mac address of the bluetooth controller.
Sets the bluetooth controller to name
, or returns the current alias.
Return a memoized agent manager service interface.
Return a memoized bluez service interface object.
A new connection from a client device.
Return a memoized dbus system instance. This connects to dbus immediately.
Given a valid dbus device path
, return a bluez service interface. If the device is nonexistent or invalid, returns nil
.
Returns true
if bluez believes the device at path
has been paired.
A connected client has broken their connection. NOTE: This currently does not appear to fire on a client socket close. Leaving this in place, but unfortunately most of the disconnection logic will need to be on Socket exceptions, for the time being.
Make this device discoverable to other bluetooth devices for timeout
seconds. Setting timeout
to 0 makes discoverable permanent until manually disabled. A timeout of nil
disables.
Convert a bluetooth mac address to a bluez device path.
Return a memoized object manager interface.
Use the ObjectManager to notice found devices when discovery scanning is enabled. Yields device path
and interface
to the block.
Use the ObjectManager to notice removed devices when scanning is enabled. Yields device path
and interface
to the block.
Attempt to pair and trust the device at path
, either a dbus device or a path to one. Returns true
if successful, false
if cancelled or the pairing request times out.
Enable the controller. Note: if the controller is off, this blocks until ready. If already on, this is a no-op.
Return a memoized profile manager interface.
DBus API: we have no additional cleanup to perform.
Returns true if the adapter is currently scanning.
Create a new pairing agent, and emit newly found devices to our Actor parent for pairing.
Start a new dbus event loop, for catching async dbus events.
Search for discoverable devices, optionally limiting to a mac address pattern filter
.
Create a new SPP callback instance, and start the glib event loop.
Unregister the pairing agent and cleanly shut down the dbus event loop.
Turn off scanning - checks if it is on first, as it’s a dbus error otherwise.
Unregister the serial agent and cleanly shut down the profile event loop.
Removes cached devices and any previous pairing state.