new BtProfileAdaptor(this);
QDBusConnection::systemBus().registerObject("/org/bluez/spp", this);
+
+ QDBusInterface profileManagerIface("org.bluez", "/org/bluez", "org.bluez.ProfileManager1", QDBusConnection::systemBus());
+
+ QVariantMap options;
+ options["Name"] = "spp";
+ options["Role"] = "server";
+
+ QDBusReply<void> reply = profileManagerIface.call("RegisterProfile", qVariantFromValue(QDBusObjectPath("/org/bluez/spp")), "00001101-0000-1000-8000-00805F9B34FB", options);
+
+ if(!reply.isValid())
+ {
+ DebugOut(DebugOut::Error)<<"RegisterProfile call failed: "<<reply.error().message().toStdString()<<endl;
+ }
}
BtProfileAdaptor::BtProfileAdaptor(BluetoothSinkPlugin *parent)
:QDBusAbstractAdaptor(parent), mParent(parent)
{
- QDBusInterface profileManagerIface("org.bluez", "/org/bluez", "org.bluez.ProfileManager1", QDBusConnection::systemBus());
-
- QVariantMap options;
- options["Name"] = "spp";
- options["Role"] = "server";
- QDBusReply<void> reply = profileManagerIface.call("RegisterProfile", qVariantFromValue(QDBusObjectPath("/org/bluez/spp")), "00001101-0000-1000-8000-00805F9B34FB", options);
-
- if(!reply.isValid())
- {
- DebugOut(DebugOut::Error)<<"RegisterProfile call failed: "<<reply.error().message().toStdString()<<endl;
- }
}
void BtProfileAdaptor::Release()
if(!manager)
{
- DebugOut(0)<<"Error getting bluetooth manager proxy: "<<error->message<<endl;
+ DebugOut(DebugOut::Warning)<<"Error getting bluetooth manager proxy: "<<error->message<<endl;
g_error_free(error);
return "";
}
{
if(!org_bluez_manager_call_find_adapter_sync(manager,adapterAddy.c_str(), &adapterPath, NULL, &error))
{
- DebugOut(0)<<"Error getting bluetooth adapter ("<<adapterAddy<<"): "<<error->message<<endl;
+ DebugOut(DebugOut::Warning)<<"Error getting bluetooth adapter ("<<adapterAddy<<"): "<<error->message<<endl;
g_error_free(error);
return "";
}
{
if(!org_bluez_manager_call_default_adapter_sync(manager,&adapterPath, NULL, &error))
{
- DebugOut(0)<<"Error getting bluetooth default adapter: "<<error->message<<endl;
+ DebugOut(DebugOut::Warning)<<"Error getting bluetooth default adapter: "<<error->message<<endl;
g_error_free(error);
return "";
}
"org.bluez",adapterPath,NULL,&error);
if(!adapter)
{
- DebugOut(0)<<"Error getting bluetooth adapter proxy: "<<error->message<<endl;
+ DebugOut(DebugOut::Warning)<<"Error getting bluetooth adapter proxy: "<<error->message<<endl;
g_error_free(error);
return "";
}
if(!org_bluez_adapter_call_find_device_sync(adapter,address.c_str(),&devicePath,NULL,&error) ||
std::string(devicePath) == "")
{
- DebugOut(0)<<"Error finding bluetooth device: "<<address<<error->message<<endl;
+ DebugOut(DebugOut::Warning)<<"Error finding bluetooth device: "<<address<<error->message<<endl;
g_error_free(error);
return "";
}
if(!serialDevice)
{
- DebugOut(0)<<"Error getting bluetooth serial device proxy: "<<error->message<<endl;
+ DebugOut(DebugOut::Warning)<<"Error getting bluetooth serial device proxy: "<<error->message<<endl;
g_error_free(error);
return "";
}
gchar* serialDeviceName;
if(!org_bluez_serial_call_connect_sync(serialDevice,"spp",&serialDeviceName,NULL,&error))
{
- DebugOut(0)<<"Error connecting bluetooth serial device: "<<address<<" - "<<error->message<<endl;
+ DebugOut(DebugOut::Warning)<<"Error connecting bluetooth serial device: "<<address<<" - "<<error->message<<endl;
g_error_free(error);
return "";
}
if(!manager)
{
- DebugOut(0)<<"Error getting bluetooth manager proxy: "<<error->message<<endl;
+ DebugOut(DebugOut::Warning)<<"Error getting bluetooth manager proxy: "<<error->message<<endl;
g_error_free(error);
return ;
}
{
if(!org_bluez_manager_call_find_adapter_sync(manager,adapterAddy.c_str(), &adapterPath, NULL, &error))
{
- DebugOut(0)<<"Error getting bluetooth adapter ("<<adapterAddy<<"): "<<error->message<<endl;
+ DebugOut(DebugOut::Warning)<<"Error getting bluetooth adapter ("<<adapterAddy<<"): "<<error->message<<endl;
g_error_free(error);
return ;
}
{
if(!org_bluez_manager_call_default_adapter_sync(manager,&adapterPath, NULL, &error))
{
- DebugOut(0)<<"Error getting bluetooth default adapter: "<<error->message<<endl;
+ DebugOut(DebugOut::Warning)<<"Error getting bluetooth default adapter: "<<error->message<<endl;
g_error_free(error);
return ;
}
"org.bluez",adapterPath,NULL,&error);
if(!adapter)
{
- DebugOut(0)<<"Error getting bluetooth adapter proxy: "<<error->message<<endl;
+ DebugOut(DebugOut::Warning)<<"Error getting bluetooth adapter proxy: "<<error->message<<endl;
g_error_free(error);
return ;
}
if(!org_bluez_adapter_call_find_device_sync(adapter,address.c_str(),&devicePath,NULL,&error) ||
std::string(devicePath) == "")
{
- DebugOut(0)<<"Error finding bluetooth device: "<<address<<error->message<<endl;
+ DebugOut(DebugOut::Warning)<<"Error finding bluetooth device: "<<address<<error->message<<endl;
g_error_free(error);
return ;
}
if(!serialDevice)
{
- DebugOut(0)<<"Error getting bluetooth serial device proxy: "<<error->message<<endl;
+ DebugOut(DebugOut::Warning)<<"Error getting bluetooth serial device proxy: "<<error->message<<endl;
g_error_free(error);
return ;
}
gchar* serialDeviceName;
if(!org_bluez_serial_call_disconnect_sync(serialDevice,"spp",NULL,&error))
{
- DebugOut(0)<<"Error disconnecting bluetooth serial device: "<<address<<" - "<<error->message<<endl;
+ DebugOut(DebugOut::Warning)<<"Error disconnecting bluetooth serial device: "<<address<<" - "<<error->message<<endl;
g_error_free(error);
return ;
}