Re: Opie bluetooth applet.

Dmitriy Korovkin <[email protected]>
Newsgroups gmane.comp.handhelds.opie.devel
Message-ID <[email protected]>
Hi Slavek,
I understand it's always good to implement something you think new and 
cool. But:
1. Why text file - not configuration file?
2. What to do with this file? How the user will configure it?
3. etc etc etc
I've already spen pretty much time trying to coordinate many cool but 
1/4 working improvements specially in BT subsystem of OPIE.
Please contact me to coordinate the changes good to make. Don't make 
OPIE useless and let all "Linux coolest boys" say that Linux on 
handhelds is just a toy - not a functional system like WinCE.
Thanks for understanding,

Dmitriy



Slavek Banko wrote:

>Hi.
>
>Here is patch to add simple support for /etc/sysconfig/bluetooth. If 
>configuration file exists, values BLUETOOTH_(PORT|PROTOCOL|SPEED) is 
>readed and used to create device. If file not exists, is used previous 
>code with switch by model.
>
>Note: Configuration file is readed as text file, not executed as shell 
>script (see GPE, /etc/bluetooth/hciattach).
>
>Slavek
>  
>
>------------------------------------------------------------------------
>
>diff -aruN opie-bluetoothapplet.orig/opie/noncore/net/opietooth/applet/bluezapplet.cpp opie-bluetoothapplet/opie/noncore/net/opietooth/applet/bluezapplet.cpp
>--- opie-bluetoothapplet.orig/opie/noncore/net/opietooth/applet/bluezapplet.cpp	2006-05-30 17:08:53.000000000 +0200
>+++ opie-bluetoothapplet/opie/noncore/net/opietooth/applet/bluezapplet.cpp	2006-06-21 19:45:17.000000000 +0200
>@@ -49,6 +49,8 @@
> #include <qstring.h>
> #include <qtimer.h>
> #include <qpopupmenu.h>
>+#include <qfile.h>
>+#include <qtextstream.h>
> 
> /* STD */
> #include <device.h>
>@@ -103,22 +105,41 @@
>     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_iPAQ_H22xx:
>-		btDevice = new Device( "/dev/tts/3", "any", "921600" );
>-		break;
>-
>-            default:
>-                btDevice = new Device( "/dev/ttySB0", "bcsp", "230400" );
>-                break;
>+	    QFile cfg("/etc/sysconfig/bluetooth");
>+	    if(cfg.open(IO_ReadOnly)) {
>+	        QTextStream stream (&cfg);
>+    		QString streamIn = stream.read();
>+        	QStringList list = QStringList::split("\n", streamIn);
>+		cfg.close();
>+		if(list.grep("BLUETOOTH_PORT=").count() > 0 &&
>+                   list.grep("BLUETOOTH_PROTOCOL=").count() > 0 &&
>+                   list.grep("BLUETOOTH_SPEED=").count() > 0) {
>+		    btDevice = new Device( list.grep("BLUETOOTH_PORT=")[0].
>+                                           replace((QString)"BLUETOOTH_PORT=", ""),
>+                                           list.grep("BLUETOOTH_PROTOCOL=")[0].
>+                                           replace((QString)"BLUETOOTH_PROTOCOL=", ""),
>+                                           list.grep("BLUETOOTH_SPEED=")[0].
>+                                           replace((QString)"BLUETOOTH_SPEED=", ""));
>+		}
>+	    }
>+	    if(!btDevice) {
>+                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_iPAQ_H22xx:
>+		    btDevice = new Device( "/dev/tts/3", "any", "921600" );
>+		    break;
>+
>+        	default:
>+            	    btDevice = new Device( "/dev/ttySB0", "bcsp", "230400" );
>+            	    break;
>+		}
>             }
>         } else {
>             if ( btDevice ) {
>  
>
_______________________________________________

http://opie.handhelds.org/cgi-bin/moin.cgi/DeveloperWikiIndex

Opie-devel mailing list
[email protected]
https://handhelds.org/mailman/listinfo/opie-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.