1 #include "bluetoothbaseagent.h"
3 #include "agentadaptor.h"
4 #include "bluemanager.h"
5 #include "blueadapter.h"
8 BluetoothBaseAgent::BluetoothBaseAgent(QString path, QObject *parent):QObject(parent),requestAccepted(false)
10 new AgentAdaptor(this);
11 QDBusConnection::systemBus().registerObject(path,this);
13 OrgBluezManagerInterface manager(
15 "/", QDBusConnection::systemBus());
17 QDBusObjectPath adapterpath = manager.DefaultAdapter();
19 OrgBluezAdapterInterface adapter(
22 QDBusConnection::systemBus());
24 adapter.RegisterAgent(QDBusObjectPath("/pairing/agent"),"");
26 qDebug()<<"last error: "<<adapter.lastError().message();
30 void BluetoothBaseAgent::authorize(OrgBluezDeviceInterface &device, QString uuid)
37 void BluetoothBaseAgent::confirmModeChange(QString mode)
39 qDebug()<<"mode changed "<<mode;
42 void BluetoothBaseAgent::displayPasskey(OrgBluezDeviceInterface &device, uint key)
44 qDebug()<<"display key "<<device.path()<<" "<<key;
47 void BluetoothBaseAgent::release()
49 qDebug("release called");
52 void BluetoothBaseAgent::requestConfirmation(OrgBluezDeviceInterface &device, uint key)
54 QVariantMap props = device.GetProperties();
56 QString alias = props["Alias"].toString();
58 qDebug()<<"Pairing with "<< alias << " with key: "+QString::number(key);
61 uint BluetoothBaseAgent::requestPasskey(OrgBluezDeviceInterface &device)
68 QString BluetoothBaseAgent::requestPidCode(OrgBluezDeviceInterface &device)
74 void BluetoothBaseAgent::accept()
76 requestAccepted = true;
79 void BluetoothBaseAgent::doReject()
83 requestAccepted=false;