author | mickeyl <mickeyl> | 2005-07-15 19:50:35 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2005-07-15 19:50:35 (UTC) |
commit | 637271751ea243456c9c00319e59675f47dcc022 (patch) (unidiff) | |
tree | b17c488a688da6aa004991206d1b2b0aae2f40c7 /examples | |
parent | 72224480ec012cf8d68608aea5a1b035f4d16895 (diff) | |
download | opie-637271751ea243456c9c00319e59675f47dcc022.zip opie-637271751ea243456c9c00319e59675f47dcc022.tar.gz opie-637271751ea243456c9c00319e59675f47dcc022.tar.bz2 |
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.
-rw-r--r-- | examples/opiebluez/oblueztest/main.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
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 | |||
@@ -8,5 +8,4 @@ int main( int argc, char** argv ) | |||
8 | { | 8 | { |
9 | OBluetooth* sys = OBluetooth::instance(); | 9 | OBluetooth* sys = OBluetooth::instance(); |
10 | |||
11 | OBluetooth::InterfaceIterator it = sys->iterator(); | 10 | OBluetooth::InterfaceIterator it = sys->iterator(); |
12 | 11 | ||
@@ -14,7 +13,19 @@ int main( int argc, char** argv ) | |||
14 | { | 13 | { |
15 | odebug << "APP: Bluetooth host controller interface '" << it.current()->name() << "' has MAC '" << it.current()->macAddress() << "'" << oendl; | 14 | odebug << "APP: Bluetooth host controller interface '" << it.current()->name() << "' has MAC '" << it.current()->macAddress() << "'" << oendl; |
16 | odebug << "APP: Interface is " << ( it.current()->isUp() ? "UP" : "DOWN" ) << ". Trying to toggle state..." << oendl; | ||
17 | it.current()->setUp( !it.current()->isUp() ); | ||
18 | odebug << "APP: Interface is " << ( it.current()->isUp() ? "UP" : "DOWN" ) << "." << oendl; | 15 | odebug << "APP: Interface is " << ( it.current()->isUp() ? "UP" : "DOWN" ) << "." << oendl; |
16 | //odebug << "APP: Trying to toggle state..." << oendl; | ||
17 | //it.current()->setUp( !it.current()->isUp() ); | ||
18 | //odebug << "APP: Interface is " << ( it.current()->isUp() ? "UP" : "DOWN" ) << "." << oendl; | ||
19 | |||
20 | odebug << "APP: scanning..." << oendl; | ||
21 | |||
22 | OBluetoothInterface::DeviceIterator devit = it.current()->neighbourhood(); | ||
23 | while( devit.current() ) | ||
24 | { | ||
25 | odebug << "APP: Neighbourhood '" << devit.current()->name() << "' has MAC '" << devit.current()->macAddress() << "'" << oendl; | ||
26 | odebug << "APP: Neighbourhood '" << devit.current()->name() << "' has class '" << devit.current()->deviceClass() << "'" << oendl; | ||
27 | ++devit; | ||
28 | } | ||
29 | |||
19 | ++it; | 30 | ++it; |
20 | } | 31 | } |