Implements org.bluez.Agent1, the pairing agent BlueZ calls back into during a Pair() handshake. More...
#include <PhosphorServiceBluetooth/BluetoothAgent.h>
Public Slots | |
| void | Release () |
| QString | RequestPinCode (const QDBusObjectPath &device) |
| void | DisplayPinCode (const QDBusObjectPath &device, const QString &pincode) |
| uint | RequestPasskey (const QDBusObjectPath &device) |
| void | DisplayPasskey (const QDBusObjectPath &device, uint passkey, ushort entered) |
| void | RequestConfirmation (const QDBusObjectPath &device, uint passkey) |
| void | RequestAuthorization (const QDBusObjectPath &device) |
| void | AuthorizeService (const QDBusObjectPath &device, const QString &uuid) |
| void | Cancel () |
Signals | |
| void | availableChanged () |
| void | pinCodeRequested (const QString &devicePath, quint64 requestId) |
A PIN code (legacy) is required for devicePath. | |
| void | passkeyRequested (const QString &devicePath, quint64 requestId) |
| A numeric passkey is required. Answer with respondPasskey / rejectRequest. | |
| void | confirmationRequested (const QString &devicePath, quint32 passkey, quint64 requestId) |
Confirm that passkey matches the one shown on devicePath. | |
| void | authorizationRequested (const QString &devicePath, quint64 requestId) |
| Authorize an incoming pairing with no MITM protection. | |
| void | serviceAuthorizationRequested (const QString &devicePath, const QString &uuid, quint64 requestId) |
Authorize uuid on devicePath. | |
| void | pinCodeDisplayed (const QString &devicePath, const QString &pinCode) |
Display-only: show pinCode / passkey to the user (no response). | |
| void | passkeyDisplayed (const QString &devicePath, quint32 passkey, quint16 entered) |
| void | requestCancelled () |
| BlueZ withdrew the in-flight request (Cancel); any prompt should close. | |
| void | released () |
| BlueZ released the agent (Release); it is no longer registered. | |
Public Member Functions | |
| BluetoothAgent (QObject *parent=nullptr) | |
| ~BluetoothAgent () override | |
| bool | available () const |
| void | setAvailable (bool available) |
| Internal registration state, updated by BluetoothHost. | |
| int | pendingRequestCount () const |
| Number of requests awaiting a consumer response. | |
| void | respondPinCode (quint64 requestId, const QString &pinCode) |
| void | respondPasskey (quint64 requestId, quint32 passkey) |
| void | respondConfirmation (quint64 requestId, bool accept) |
Accept (or, with accept false, reject) a confirmation / authorization / service-authorization request. | |
| void | rejectRequest (quint64 requestId) |
| Reject any pending request with org.bluez.Error.Rejected. | |
Static Public Member Functions | |
| static QString | agentPath () |
| Object path the agent is exported at and registered under with org.bluez.AgentManager1. | |
Implements org.bluez.Agent1, the pairing agent BlueZ calls back into during a Pair() handshake.
Registered by BluetoothHost with KeyboardDisplay capability, this is the library's only D-Bus server object. The interactive callbacks (RequestPinCode / RequestPasskey / RequestConfirmation / RequestAuthorization / AuthorizeService) cannot answer BlueZ synchronously: they need the user. Each therefore takes a delayed D-Bus reply (QDBusContext::setDelayedReply) and emits a Qt request signal carrying a requestId; a consumer (the CLI now, a pairing dialog later) answers via respondPinCode / respondPasskey / respondConfirmation / rejectRequest, which sends the held reply.
The agent is implemented directly on this QObject (exported via ExportAllSlots) rather than through a generated QDBusAbstractAdaptor, because the adaptor would become QtDBus's dispatch target and setDelayedReply would no longer apply to this object's calls. Display-only callbacks (DisplayPinCode / DisplayPasskey) and Release / Cancel return immediately.
|
explicit |
|
override |
|
staticnodiscard |
Object path the agent is exported at and registered under with org.bluez.AgentManager1.
|
signal |
Authorize an incoming pairing with no MITM protection.
Answer with respondConfirmation / rejectRequest.
|
slot |
|
nodiscard |
|
signal |
|
slot |
|
signal |
Confirm that passkey matches the one shown on devicePath.
Answer with respondConfirmation(requestId, accept) or rejectRequest.
|
slot |
|
slot |
|
signal |
|
signal |
A numeric passkey is required. Answer with respondPasskey / rejectRequest.
|
nodiscard |
Number of requests awaiting a consumer response.
Primarily for tests and introspection.
|
signal |
Display-only: show pinCode / passkey to the user (no response).
|
signal |
A PIN code (legacy) is required for devicePath.
Answer with respondPinCode(requestId, ...) or rejectRequest(requestId).
| void PhosphorServiceBluetooth::BluetoothAgent::rejectRequest | ( | quint64 | requestId | ) |
Reject any pending request with org.bluez.Error.Rejected.
|
slot |
|
signal |
BlueZ released the agent (Release); it is no longer registered.
|
slot |
|
signal |
BlueZ withdrew the in-flight request (Cancel); any prompt should close.
|
slot |
|
slot |
|
slot |
| void PhosphorServiceBluetooth::BluetoothAgent::respondConfirmation | ( | quint64 | requestId, |
| bool | accept ) |
Accept (or, with accept false, reject) a confirmation / authorization / service-authorization request.
| void PhosphorServiceBluetooth::BluetoothAgent::respondPasskey | ( | quint64 | requestId, |
| quint32 | passkey ) |
| void PhosphorServiceBluetooth::BluetoothAgent::respondPinCode | ( | quint64 | requestId, |
| const QString & | pinCode ) |
|
signal |
Authorize uuid on devicePath.
Answer with respondConfirmation / rejectRequest.
| void PhosphorServiceBluetooth::BluetoothAgent::setAvailable | ( | bool | available | ) |
Internal registration state, updated by BluetoothHost.