summaryrefslogtreecommitdiff
path: root/noncore/net/opietooth/manager
Unidiff
Diffstat (limited to 'noncore/net/opietooth/manager') (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/opietooth/manager/bluebase.cpp61
-rw-r--r--noncore/net/opietooth/manager/bluebase.h4
-rw-r--r--noncore/net/opietooth/manager/bluetoothbase.ui182
3 files changed, 234 insertions, 13 deletions
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp
index 0649514..9ec5bf8 100644
--- a/noncore/net/opietooth/manager/bluebase.cpp
+++ b/noncore/net/opietooth/manager/bluebase.cpp
@@ -21,6 +21,10 @@
21#include "devicehandler.h" 21#include "devicehandler.h"
22#include "btconnectionitem.h" 22#include "btconnectionitem.h"
23#include "rfcommassigndialogimpl.h" 23#include "rfcommassigndialogimpl.h"
24#include "forwarder.h"
25#include <termios.h>
26#include <string.h>
27#include <errno.h>
24 28
25/* OPIE */ 29/* OPIE */
26#include <qpe/qpeapplication.h> 30#include <qpe/qpeapplication.h>
@@ -41,6 +45,7 @@ using namespace Opie::Core;
41#include <qscrollview.h> 45#include <qscrollview.h>
42#include <qvbox.h> 46#include <qvbox.h>
43#include <qmessagebox.h> 47#include <qmessagebox.h>
48#include <qcombobox.h>
44#include <qcheckbox.h> 49#include <qcheckbox.h>
45#include <qlineedit.h> 50#include <qlineedit.h>
46#include <qlistview.h> 51#include <qlistview.h>
@@ -55,6 +60,16 @@ using namespace Opie::Core;
55#include <stdlib.h> 60#include <stdlib.h>
56 61
57using namespace OpieTooth; 62using namespace OpieTooth;
63//Array of possible speeds of the serial port
64struct SerSpeed {
65 const char* str; //string value
66 int val; //value itself
67} speeds[] = {
68 { "150", B150 }, { "300", B300 }, { "600", B600 }, { "1200", B1200 },
69 { "2400", B2400 }, { "4800", B4800 }, { "9600", B9600 },
70 { "19200", B19200 }, { "38400", B38400 }, { "57600", B57600 },
71 { "115200", B115200}
72};
58 73
59BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) 74BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl )
60 : BluetoothBase( parent, name, fl ) 75 : BluetoothBase( parent, name, fl )
@@ -78,6 +93,7 @@ BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl )
78 this, SLOT( addConnectedDevices(ConnectionState::ValueList) ) ); 93 this, SLOT( addConnectedDevices(ConnectionState::ValueList) ) );
79 connect( m_localDevice, SIGNAL( signalStrength(const QString&,const QString&) ), 94 connect( m_localDevice, SIGNAL( signalStrength(const QString&,const QString&) ),
80 this, SLOT( addSignalStrength(const QString&,const QString&) ) ); 95 this, SLOT( addSignalStrength(const QString&,const QString&) ) );
96 connect(runButton, SIGNAL(clicked()), this, SLOT(doForward()));
81 97
82 // let hold be rightButtonClicked() 98 // let hold be rightButtonClicked()
83 QPEApplication::setStylusOperation( devicesView->viewport(), QPEApplication::RightOnHold); 99 QPEApplication::setStylusOperation( devicesView->viewport(), QPEApplication::RightOnHold);
@@ -108,6 +124,12 @@ BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl )
108 readSavedDevices(); 124 readSavedDevices();
109 addServicesToDevices(); 125 addServicesToDevices();
110 QTimer::singleShot( 3000, this, SLOT( addServicesToDevices() ) ); 126 QTimer::singleShot( 3000, this, SLOT( addServicesToDevices() ) );
127 forwarder = NULL;
128 serDevName->setText(tr("/dev/ircomm0"));
129 for (unsigned int i = 0; i < (sizeof(speeds) / sizeof(speeds[0])); i++) {
130 serSpeed->insertItem(speeds[i].str);
131 }
132 serSpeed->setCurrentItem((sizeof(speeds) / sizeof(speeds[0])) - 1);
111} 133}
112 134
113/** 135/**
@@ -680,3 +702,42 @@ bool BlueBase::find( const RemoteDevice& rem )
680 } 702 }
681 return false; // not found 703 return false; // not found
682} 704}
705
706/**
707 * Start process of the cell phone forwarding
708 */
709void BlueBase::doForward()
710{
711 if (forwarder && forwarder->isRunning()) {
712 runButton->setText("start gateway");
713 forwarder->stop();
714 delete forwarder;
715 forwarder = NULL;
716 return;
717 }
718 QString str = serDevName->text();
719 forwarder = new SerialForwarder(str, speeds[serSpeed->currentItem()].val);
720 connect(forwarder, SIGNAL(processExited(Opie::Core::OProcess*)),
721 this, SLOT(forwardExited(Opie::Core::OProcess*)));
722 if (forwarder->start(OProcess::NotifyOnExit) < 0) {
723 QMessageBox::critical(this, tr("Forwarder Error"),
724 tr("Forwarder start error:") + tr(strerror(errno)));
725 return;
726 }
727 runButton->setText("stop gateway");
728}
729
730/**
731 * React on the process end
732 */
733void BlueBase::forwardExit(Opie::Core::OProcess* proc)
734{
735 if (proc->exitStatus() != 0)
736 QMessageBox::critical(this, tr("Forwarder Error"),
737 tr("Forwarder start error"));
738 delete proc;
739 forwarder = NULL;
740 runButton->setText("start gateway");
741}
742
743//eof
diff --git a/noncore/net/opietooth/manager/bluebase.h b/noncore/net/opietooth/manager/bluebase.h
index 48883d2..0128a88 100644
--- a/noncore/net/opietooth/manager/bluebase.h
+++ b/noncore/net/opietooth/manager/bluebase.h
@@ -17,6 +17,7 @@
17#include "popuphelper.h" 17#include "popuphelper.h"
18 18
19#include "bticonloader.h" 19#include "bticonloader.h"
20#include "forwarder.h"
20 21
21#include <remotedevice.h> 22#include <remotedevice.h>
22#include <manager.h> 23#include <manager.h>
@@ -79,6 +80,7 @@ namespace OpieTooth {
79 QPixmap m_findPix; 80 QPixmap m_findPix;
80 81
81 BTIconLoader *m_iconLoader; 82 BTIconLoader *m_iconLoader;
83 SerialForwarder* forwarder;
82 84
83 private slots: 85 private slots:
84 void addSearchedDevices( const QValueList<RemoteDevice> &newDevices ); 86 void addSearchedDevices( const QValueList<RemoteDevice> &newDevices );
@@ -91,6 +93,8 @@ namespace OpieTooth {
91 void startServiceActionHold( QListViewItem *, const QPoint &, int ); 93 void startServiceActionHold( QListViewItem *, const QPoint &, int );
92 void deviceActive( const QString& mac, bool connected ); 94 void deviceActive( const QString& mac, bool connected );
93 void applyConfigChanges(); 95 void applyConfigChanges();
96 void doForward();
97 void forwardExit(Opie::Core::OProcess* proc);
94 void addSignalStrength(); 98 void addSignalStrength();
95 void addSignalStrength( const QString& mac, const QString& strengh ); 99 void addSignalStrength( const QString& mac, const QString& strengh );
96 void rfcommDialog(); 100 void rfcommDialog();
diff --git a/noncore/net/opietooth/manager/bluetoothbase.ui b/noncore/net/opietooth/manager/bluetoothbase.ui
index cbde3c6..a5e2c6f 100644
--- a/noncore/net/opietooth/manager/bluetoothbase.ui
+++ b/noncore/net/opietooth/manager/bluetoothbase.ui
@@ -11,30 +11,24 @@
11 <rect> 11 <rect>
12 <x>0</x> 12 <x>0</x>
13 <y>0</y> 13 <y>0</y>
14 <width>293</width> 14 <width>268</width>
15 <height>382</height> 15 <height>368</height>
16 </rect> 16 </rect>
17 </property> 17 </property>
18 <property stdset="1"> 18 <property stdset="1">
19 <name>caption</name> 19 <name>caption</name>
20 <string>Form1</string> 20 <string>Form1</string>
21 </property> 21 </property>
22 <property> 22 <vbox>
23 <name>layoutMargin</name>
24 </property>
25 <property>
26 <name>layoutSpacing</name>
27 </property>
28 <grid>
29 <property stdset="1"> 23 <property stdset="1">
30 <name>margin</name> 24 <name>margin</name>
31 <number>4</number> 25 <number>0</number>
32 </property> 26 </property>
33 <property stdset="1"> 27 <property stdset="1">
34 <name>spacing</name> 28 <name>spacing</name>
35 <number>2</number> 29 <number>0</number>
36 </property> 30 </property>
37 <widget row="0" column="0" > 31 <widget>
38 <class>QTabWidget</class> 32 <class>QTabWidget</class>
39 <property stdset="1"> 33 <property stdset="1">
40 <name>name</name> 34 <name>name</name>
@@ -376,7 +370,169 @@
376 </widget> 370 </widget>
377 </vbox> 371 </vbox>
378 </widget> 372 </widget>
373 <widget>
374 <class>QWidget</class>
375 <property stdset="1">
376 <name>name</name>
377 <cstring>tab</cstring>
378 </property>
379 <attribute>
380 <name>title</name>
381 <string>Phone</string>
382 </attribute>
383 <vbox>
384 <property stdset="1">
385 <name>margin</name>
386 <number>0</number>
387 </property>
388 <property stdset="1">
389 <name>spacing</name>
390 <number>0</number>
391 </property>
392 <widget>
393 <class>QGroupBox</class>
394 <property stdset="1">
395 <name>name</name>
396 <cstring>cellForwarder</cstring>
397 </property>
398 <property stdset="1">
399 <name>title</name>
400 <string>Cell Forwarder</string>
401 </property>
402 <vbox>
403 <property stdset="1">
404 <name>margin</name>
405 <number>11</number>
406 </property>
407 <property stdset="1">
408 <name>spacing</name>
409 <number>6</number>
410 </property>
411 <widget>
412 <class>QLayoutWidget</class>
413 <property stdset="1">
414 <name>name</name>
415 <cstring>Layout9</cstring>
416 </property>
417 <vbox>
418 <property stdset="1">
419 <name>margin</name>
420 <number>0</number>
421 </property>
422 <property stdset="1">
423 <name>spacing</name>
424 <number>6</number>
425 </property>
426 <widget>
427 <class>QLayoutWidget</class>
428 <property stdset="1">
429 <name>name</name>
430 <cstring>Layout5</cstring>
431 </property>
432 <hbox>
433 <property stdset="1">
434 <name>margin</name>
435 <number>0</number>
436 </property>
437 <property stdset="1">
438 <name>spacing</name>
439 <number>6</number>
440 </property>
441 <widget>
442 <class>QLabel</class>
443 <property stdset="1">
444 <name>name</name>
445 <cstring>serDevLabel</cstring>
446 </property>
447 <property stdset="1">
448 <name>text</name>
449 <string>Serial device:</string>
450 </property>
379 </widget> 451 </widget>
380 </grid> 452 <widget>
453 <class>QLineEdit</class>
454 <property stdset="1">
455 <name>name</name>
456 <cstring>serDevName</cstring>
457 </property>
458 </widget>
459 </hbox>
460 </widget>
461 <widget>
462 <class>QLayoutWidget</class>
463 <property stdset="1">
464 <name>name</name>
465 <cstring>Layout6</cstring>
466 </property>
467 <hbox>
468 <property stdset="1">
469 <name>margin</name>
470 <number>0</number>
471 </property>
472 <property stdset="1">
473 <name>spacing</name>
474 <number>6</number>
475 </property>
476 <widget>
477 <class>QLabel</class>
478 <property stdset="1">
479 <name>name</name>
480 <cstring>serSpeedLabel</cstring>
481 </property>
482 <property stdset="1">
483 <name>text</name>
484 <string>Speed:</string>
485 </property>
486 </widget>
487 <widget>
488 <class>QComboBox</class>
489 <property stdset="1">
490 <name>name</name>
491 <cstring>serSpeed</cstring>
492 </property>
493 </widget>
494 </hbox>
381</widget> 495</widget>
496 <widget>
497 <class>QPushButton</class>
498 <property stdset="1">
499 <name>name</name>
500 <cstring>runButton</cstring>
501 </property>
502 <property stdset="1">
503 <name>text</name>
504 <string>start gateway</string>
505 </property>
506 </widget>
507 </vbox>
508 </widget>
509 </vbox>
510 </widget>
511 </vbox>
512 </widget>
513 </widget>
514 </vbox>
515</widget>
516<customwidgets>
517 <customwidget>
518 <class>QWidget</class>
519 <header location="local">qwidget.h</header>
520 <sizehint>
521 <width>100</width>
522 <height>100</height>
523 </sizehint>
524 <container>0</container>
525 <sizepolicy>
526 <hordata>7</hordata>
527 <verdata>7</verdata>
528 </sizepolicy>
529 <pixmap>image0</pixmap>
530 </customwidget>
531</customwidgets>
532<images>
533 <image>
534 <name>image0</name>
535 <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data>
536 </image>
537</images>
382</UI> 538</UI>