author | zecke <zecke> | 2005-11-02 20:11:29 (UTC) |
---|---|---|
committer | zecke <zecke> | 2005-11-02 20:11:29 (UTC) |
commit | 18d6f344e4656e7f77497d345f1480cecd4d2f31 (patch) (side-by-side diff) | |
tree | bf9771459177e2835e1047a6178f11b420bed9e5 | |
parent | 562ff5c89ae1da92172a086afc8c3ffb7eec23bd (diff) | |
download | opie-18d6f344e4656e7f77497d345f1480cecd4d2f31.zip opie-18d6f344e4656e7f77497d345f1480cecd4d2f31.tar.gz opie-18d6f344e4656e7f77497d345f1480cecd4d2f31.tar.bz2 |
Opie Bluetooth Applet:
Start hciattach with the right commands for the Asus MyPal.
Patch is courtsey Pawel Kolodziejski
-rw-r--r-- | noncore/net/opietooth/applet/bluezapplet.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/noncore/net/opietooth/applet/bluezapplet.cpp b/noncore/net/opietooth/applet/bluezapplet.cpp index e1c2341..5676e4f 100644 --- a/noncore/net/opietooth/applet/bluezapplet.cpp +++ b/noncore/net/opietooth/applet/bluezapplet.cpp @@ -51,128 +51,132 @@ using namespace Opie::Core; #include <qpopupmenu.h> /* STD */ #include <device.h> namespace OpieTooth { BluezApplet::BluezApplet( QWidget *parent, const char *name ) : QWidget( parent, name ) { setFixedHeight( AppLnk::smallIconSize() ); setFixedWidth( AppLnk::smallIconSize() ); bluezOnPixmap = OResource::loadImage( "bluetoothapplet/bluezon", OResource::SmallIcon ); bluezOffPixmap = OResource::loadImage( "bluetoothapplet/bluezoff", Opie::Core::OResource::SmallIcon ); bluezDiscoveryOnPixmap = OResource::loadImage( "bluetoothapplet/bluezondiscovery", Opie::Core::OResource::SmallIcon ); startTimer(4000); btDevice = 0; btManager = 0; bluezactive = false; bluezDiscoveryActive = false; // TODO: determine whether this channel has to be closed at destruction time. QCopChannel* chan = new QCopChannel("QPE/Bluetooth", this ); connect(chan, SIGNAL(received(const QCString&,const QByteArray&) ), this, SLOT(slotMessage(const QCString&,const QByteArray&) ) ); } BluezApplet::~BluezApplet() { if ( btDevice ) { delete btDevice; } if ( btManager ) { delete btManager; } } int BluezApplet::position() { return 6; } bool BluezApplet::checkBluezStatus() { if (btDevice) { if (btDevice->isLoaded() ) { return true; } else { return false; } } else { return false; } } int BluezApplet::setBluezStatus(int c) { 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; + case Model_MyPal_716: + btDevice = new Device( "/dev/ttyS1", "bcsp", "921600" ); + break; + default: btDevice = new Device( "/dev/ttySB0", "bcsp", "230400" ); break; } } else { if ( btDevice ) { delete btDevice; btDevice = 0; } } return 0; } int BluezApplet::checkBluezDiscoveryStatus() { return bluezDiscoveryActive; } 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()") { if (!checkBluezStatus()) { setBluezStatus(1); } } else if ( str == "disableBluetooth()") { if (checkBluezStatus()) { // setBluezStatus(0); } } else if ( str == "listDevices()") { if (!btManager) { btManager = new Manager("hci0"); connect( btManager, SIGNAL( foundDevices(const QString&,RemoteDevice::ValueList) ), this, SLOT( fillList(const QString&,RemoteDevice::ValueList) ) ) ; } btManager->searchDevices(); } } // Once the hcitool scan is complete, report back. void BluezApplet::fillList(const QString&, RemoteDevice::ValueList deviceList) { QCopEnvelope e("QPE/BluetoothBack", "devices(QStringMap)"); QStringList list; QMap<QString, QString> btmap; RemoteDevice::ValueList::Iterator it; for( it = deviceList.begin(); it != deviceList.end(); ++it ) { btmap[(*it).name()] = (*it).mac(); } e << btmap; } void BluezApplet::mousePressEvent( QMouseEvent *) { |