nsresult StartBluetoothConnection() { if (sDBusConnection) { NS_WARNING("DBusConnection already established, skipping"); return NS_OK; } sBluetoothEventObserverTable = new BluetoothEventObserverTable(); sBluetoothEventObserverTable->Init(100); sDBusConnection = new RawDBusConnection(); sDBusConnection->EstablishDBusConnection(); // Add a filter for all incoming messages_base if (!dbus_connection_add_filter(sDBusConnection->mConnection, EventFilter, NULL, NULL)) { NS_WARNING("Cannot create DBus Event Filter for DBus Thread!"); return NS_ERROR_FAILURE; } return NS_OK; }