From 637271751ea243456c9c00319e59675f47dcc022 Mon Sep 17 00:00:00 2001 From: mickeyl Date: Fri, 15 Jul 2005 19:50:35 +0000 Subject: opiebluez: add scanning. Ok, guys, everything until now was easy. It gets very ugly to go from here - even to just get the name of a remote device, you have to setup some filters on the bluez socket, fill in some random flags to generate a PDU that calls 'get name' and then afterwards poll until the result comes in. Nasty :/ The BlueZ kernel interface seems to be very badly (if at all) documented. All people are assuming that you use libbluetooth to talk to that stack. However since libbluetooth is GPL, we can't do that :/ Guess, we are stuck here until someone finds time and/or motivation to look into that and create some easy-to-understand examples for how to talk directly to the BlueZ kernel interface. --- (limited to 'examples') diff --git a/examples/opiebluez/oblueztest/main.cpp b/examples/opiebluez/oblueztest/main.cpp index 361dbd8..6c2ca75 100644 --- a/examples/opiebluez/oblueztest/main.cpp +++ b/examples/opiebluez/oblueztest/main.cpp @@ -7,15 +7,26 @@ using namespace Opie::Bluez; int main( int argc, char** argv ) { OBluetooth* sys = OBluetooth::instance(); - OBluetooth::InterfaceIterator it = sys->iterator(); while( it.current() ) { odebug << "APP: Bluetooth host controller interface '" << it.current()->name() << "' has MAC '" << it.current()->macAddress() << "'" << oendl; - odebug << "APP: Interface is " << ( it.current()->isUp() ? "UP" : "DOWN" ) << ". Trying to toggle state..." << oendl; - it.current()->setUp( !it.current()->isUp() ); odebug << "APP: Interface is " << ( it.current()->isUp() ? "UP" : "DOWN" ) << "." << oendl; + //odebug << "APP: Trying to toggle state..." << oendl; + //it.current()->setUp( !it.current()->isUp() ); + //odebug << "APP: Interface is " << ( it.current()->isUp() ? "UP" : "DOWN" ) << "." << oendl; + + odebug << "APP: scanning..." << oendl; + + OBluetoothInterface::DeviceIterator devit = it.current()->neighbourhood(); + while( devit.current() ) + { + odebug << "APP: Neighbourhood '" << devit.current()->name() << "' has MAC '" << devit.current()->macAddress() << "'" << oendl; + odebug << "APP: Neighbourhood '" << devit.current()->name() << "' has class '" << devit.current()->deviceClass() << "'" << oendl; + ++devit; + } + ++it; } return 0; -- cgit v0.9.0.2