author | korovkin <korovkin> | 2006-07-02 12:08:22 (UTC) |
---|---|---|
committer | korovkin <korovkin> | 2006-07-02 12:08:22 (UTC) |
commit | adcfc6f4afe184a9eb6fbf458616494dfe0dadda (patch) (side-by-side diff) | |
tree | 5111ace883270f8e2f6da6e6578ad07ea7c650c1 /noncore | |
parent | b06b849f271079b0dd5d3419ad1162232ff4a9f5 (diff) | |
download | opie-adcfc6f4afe184a9eb6fbf458616494dfe0dadda.zip opie-adcfc6f4afe184a9eb6fbf458616494dfe0dadda.tar.gz opie-adcfc6f4afe184a9eb6fbf458616494dfe0dadda.tar.bz2 |
Added OBEX receive functionality.
-rw-r--r-- | noncore/net/opietooth/applet/bluezapplet.cpp | 54 | ||||
-rw-r--r-- | noncore/net/opietooth/applet/bluezapplet.h | 4 |
2 files changed, 42 insertions, 16 deletions
diff --git a/noncore/net/opietooth/applet/bluezapplet.cpp b/noncore/net/opietooth/applet/bluezapplet.cpp index a1d64a4..32560a1 100644 --- a/noncore/net/opietooth/applet/bluezapplet.cpp +++ b/noncore/net/opietooth/applet/bluezapplet.cpp @@ -66,2 +66,3 @@ namespace OpieTooth { bluezDiscoveryOnPixmap = Resource::loadPixmap( "bluetoothapplet/magglass.png" ); + bluezReceiveOnPixmap = Resource::loadPixmap( "bluetoothapplet/receive.png" ); #else @@ -70,2 +71,3 @@ namespace OpieTooth { bluezDiscoveryOnPixmap = OResource::loadImage( "bluetoothapplet/bluezondiscovery", Opie::Core::OResource::SmallIcon ); + bluezReceiveOnPixmap = )Resource::loadImage( "bluetoothapplet/bluezonreceive", Opie::Core::OResource::SmallIcon ); #endif @@ -76,2 +78,4 @@ namespace OpieTooth { bluezDiscoveryActive = false; + bluezReceiveActive = false; + bluezReceiveChanged = false; doListDevice = false; @@ -136,6 +140,5 @@ namespace OpieTooth { #endif - - case Model_iPAQ_H22xx: - btDevice = new Device( "/dev/tts/3", "any", "921600" ); - break; + case Model_iPAQ_H22xx: + btDevice = new Device( "/dev/tts/3", "any", "921600" ); + break; @@ -150,2 +153,3 @@ namespace OpieTooth { } else { + setObexRecieveStatus(0); ::system("/etc/init.d/bluetooth stop >/dev/null 2>/dev/null"); @@ -170,4 +174,14 @@ namespace OpieTooth { } - - // FIXME mbhaynie + + int BluezApplet::setObexRecieveStatus(int d) { + { + QCopEnvelope e ( "QPE/Obex", "btreceive(int)" ); + e << ( d ? 1 : 0 ); + } + bluezReceiveActive = (bool)(d != 0); + bluezReceiveChanged = true; + return d; + } + + // FIXME mbhaynie // receiver for QCopChannel("QPE/Bluetooth") messages. @@ -246,8 +260,9 @@ namespace OpieTooth { - if (bluezDiscoveryActive) { - menu->insertItem( tr("Disable discovery"), 3 ); - } else { - menu->insertItem( tr("Enable discovery"), 4 ); - } - + if (bluezactive) { + if (bluezReceiveActive) { + menu->insertItem( tr("Disable receive"), 3 ); + } else { + menu->insertItem( tr("Enable receive"), 4 ); + } + } @@ -272,3 +287,3 @@ namespace OpieTooth { case 3: - setBluezDiscoveryStatus(0); + setObexRecieveStatus(0); timerEvent( 0 ); @@ -276,4 +291,4 @@ namespace OpieTooth { case 4: - setBluezDiscoveryStatus(1); - timerEvent(0 ); + setObexRecieveStatus(1); + timerEvent( 0 ); break; @@ -308,3 +323,4 @@ namespace OpieTooth { if ((bluezactive != oldactive) || - (bluezDiscoveryActive != olddiscovery)) + (bluezDiscoveryActive != olddiscovery) || + bluezReceiveChanged) update(); @@ -314,2 +330,4 @@ namespace OpieTooth { } + if (bluezReceiveChanged) + bluezReceiveChanged = false; } @@ -341,3 +359,7 @@ namespace OpieTooth { } + if (bluezReceiveActive) { + p.drawPixmap( 0, 0, bluezReceiveOnPixmap ); + } } + /** diff --git a/noncore/net/opietooth/applet/bluezapplet.h b/noncore/net/opietooth/applet/bluezapplet.h index b79ed5b..9809d20 100644 --- a/noncore/net/opietooth/applet/bluezapplet.h +++ b/noncore/net/opietooth/applet/bluezapplet.h @@ -60,2 +60,3 @@ public slots: int setBluezDiscoveryStatus(int); + int setObexRecieveStatus(int); @@ -67,4 +68,7 @@ public slots: QPixmap bluezDiscoveryOnPixmap; + QPixmap bluezReceiveOnPixmap; bool bluezactive; bool bluezDiscoveryActive; + bool bluezReceiveActive; + bool bluezReceiveChanged; bool doListDevice; //If I have to list devices after bringing BT up? |