3 * meego handset bluetooth
4 * Copyright © 2010, Intel Corporation.
6 * This program is licensed under the terms and conditions of the
7 * Apache License, version 2.0. The full text of the Apache License is at
8 * http://www.apache.org/licenses/LICENSE-2.0
12 #include "bluetoothbaseagent.h"
14 #include "agentadaptor.h"
15 #include "bluemanager.h"
16 #include "blueadapter.h"
19 BluetoothBaseAgent::BluetoothBaseAgent(QString path, QObject *parent):QObject(parent),requestAccepted(false),m_path(path)
21 new AgentAdaptor(this);
22 QDBusConnection::systemBus().registerObject(path,this);
25 void BluetoothBaseAgent::registerAgent()
27 OrgBluezManagerInterface manager(
29 "/", QDBusConnection::systemBus());
31 QDBusObjectPath adapterpath = manager.DefaultAdapter();
33 OrgBluezAdapterInterface adapter(
36 QDBusConnection::systemBus());
38 adapter.RegisterAgent(QDBusObjectPath(m_path),"");
39 qDebug()<<"last error: "<<adapter.lastError().message();
42 void BluetoothBaseAgent::authorize(OrgBluezDeviceInterface &device, QString uuid)
49 void BluetoothBaseAgent::confirmModeChange(QString mode)
51 qDebug()<<"mode changed "<<mode;
54 void BluetoothBaseAgent::displayPasskey(OrgBluezDeviceInterface &device, uint key, uint entered)
56 qDebug()<<"display key "<<device.path()<<" "<<key;
58 ///create and return back an empty reply:
59 QDBusMessage reply = message().createReply();
60 connection().send(reply);
63 void BluetoothBaseAgent::release()
65 qDebug("release called");
68 void BluetoothBaseAgent::requestConfirmation(OrgBluezDeviceInterface &device, uint key)
70 QVariantMap props = device.GetProperties();
72 QString alias = props["Alias"].toString();
74 qDebug()<<"Pairing with "<< alias << " with key: "+QString::number(key);
77 uint BluetoothBaseAgent::requestPasskey(OrgBluezDeviceInterface &device)
84 QString BluetoothBaseAgent::requestPidCode(OrgBluezDeviceInterface &device)