summaryrefslogtreecommitdiff
path: root/noncore/net/opietooth/applet
authorkorovkin <korovkin>2006-05-10 13:32:46 (UTC)
committer korovkin <korovkin>2006-05-10 13:32:46 (UTC)
commit5521b2c0508cf6e6a390bd4796e8c9f2c7a6d05f (patch) (side-by-side diff)
treee9ea63a2fe15982e98886af727649dc6a513faac /noncore/net/opietooth/applet
parent620d55ae3b94fa8d2fa696b6626893e4520c3a02 (diff)
downloadopie-5521b2c0508cf6e6a390bd4796e8c9f2c7a6d05f.zip
opie-5521b2c0508cf6e6a390bd4796e8c9f2c7a6d05f.tar.gz
opie-5521b2c0508cf6e6a390bd4796e8c9f2c7a6d05f.tar.bz2
OBEX push functionality moved to libbluetooth1.
Made some reformatting in device.cc In bluezapplet.cpp /etc/init.d/bluetooth is started synchronously if it's called from QCopMessage.
Diffstat (limited to 'noncore/net/opietooth/applet') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/applet/bluezapplet.cpp12
-rw-r--r--noncore/net/opietooth/applet/bluezapplet.h2
2 files changed, 9 insertions, 5 deletions
diff --git a/noncore/net/opietooth/applet/bluezapplet.cpp b/noncore/net/opietooth/applet/bluezapplet.cpp
index 90b0c6d..6351d4e 100644
--- a/noncore/net/opietooth/applet/bluezapplet.cpp
+++ b/noncore/net/opietooth/applet/bluezapplet.cpp
@@ -95,102 +95,106 @@ namespace OpieTooth {
}
}
int BluezApplet::position()
{
return 6;
}
bool BluezApplet::checkBluezStatus() {
if (btDevice) {
if (btDevice->isLoaded() ) {
odebug << "btDevice isLoaded" << oendl;
return true;
} else {
odebug << "btDevice is NOT loaded" << oendl;
return false;
}
} else {
odebug << "btDevice is ZERO" << oendl;
return false;
}
}
- int BluezApplet::setBluezStatus(int c) {
+ int BluezApplet::setBluezStatus(int c, bool sync) {
if ( c == 1 ) {
switch ( ODevice::inst()->model() ) {
case Model_iPAQ_H39xx:
btDevice = new Device( "/dev/tts/1", "bcsp", "921600" );
break;
case Model_iPAQ_H5xxx:
btDevice = new Device( "/dev/tts/1", "any", "921600" );
break;
#ifndef OPIE120
case Model_MyPal_716:
btDevice = new Device( "/dev/ttyS1", "bcsp", "921600" );
break;
#endif
default:
btDevice = new Device( "/dev/ttySB0", "bcsp", "230400" );
break;
}
- QCopEnvelope e("QPE/System", "execute(QString)");
- e << QString("/etc/init.d/bluetooth start");
+ if (sync) {
+ ::system("/etc/init.d/bluetooth start >/dev/null 2>/dev/null");
+ } else {
+ QCopEnvelope e("QPE/System", "execute(QString)");
+ e << QString("/etc/init.d/bluetooth start");
+ }
} else {
::system("/etc/init.d/bluetooth stop >/dev/null 2>/dev/null");
if ( btManager ) {
delete btManager;
btManager = 0;
}
if ( btDevice ) {
delete btDevice;
btDevice = 0;
}
}
return 0;
}
int BluezApplet::checkBluezDiscoveryStatus() {
return isScanning;
}
int BluezApplet::setBluezDiscoveryStatus(int d) {
return bluezDiscoveryActive = d;
}
// FIXME mbhaynie
// receiver for QCopChannel("QPE/Bluetooth") messages.
void BluezApplet::slotMessage( const QCString& str, const QByteArray& )
{
if ( str == "enableBluetooth()") {
m_wasOn = checkBluezStatus();
if (!m_wasOn) {
- setBluezStatus(1);
+ setBluezStatus(1, true);
sleep(2);
}
}
else if ( str == "disableBluetooth()") {
/*
* We can down BT only if it was started by qcop. We don't want
* to down BT started from menu an break our networking connection
*/
if (checkBluezStatus() && !m_wasOn)
setBluezStatus(0);
doListDevice = false;
}
else if ( str == "listDevices()") {
if (checkBluezStatus()) {
doListDevice = false;
timerEvent(0);
if (!btManager) {
btManager = new Manager("hci0");
connect( btManager,
SIGNAL( foundDevices(const QString&, RemoteDevice::ValueList) ),
this, SLOT( fillList(const QString&, RemoteDevice::ValueList) ) ) ;
}
btManager->searchDevices();
isScanning = true;
diff --git a/noncore/net/opietooth/applet/bluezapplet.h b/noncore/net/opietooth/applet/bluezapplet.h
index 90bee3b..1937934 100644
--- a/noncore/net/opietooth/applet/bluezapplet.h
+++ b/noncore/net/opietooth/applet/bluezapplet.h
@@ -34,48 +34,48 @@
#include <qtimer.h>
#include <manager.h>
#include <opie2/oprocess.h>
namespace OpieTooth {
class Device;
class BluezApplet : public QWidget {
Q_OBJECT
public:
BluezApplet( QWidget *parent = 0, const char *name=0 );
~BluezApplet();
static int position();
protected:
void timerEvent(QTimerEvent *te );
public slots:
void fillList( const QString& device, RemoteDevice::ValueList list );
private:
void mousePressEvent( QMouseEvent * );
void paintEvent( QPaintEvent* );
void launchManager();
bool checkBluezStatus();
- int setBluezStatus(int);
+ int setBluezStatus(int, bool sync = false);
int checkBluezDiscoveryStatus();
int setBluezDiscoveryStatus(int);
private:
Device* btDevice;
Manager *btManager;
QPixmap bluezOnPixmap;
QPixmap bluezOffPixmap;
QPixmap bluezDiscoveryOnPixmap;
bool bluezactive;
bool bluezDiscoveryActive;
bool doListDevice; //If I have to list devices after bringing BT up?
bool isScanning; //If I'm scanning devices
bool m_wasOn; //If BT was started by menu?
private slots:
void slotMessage( const QCString& , const QByteArray& );
};
};
#endif