summaryrefslogtreecommitdiff
path: root/noncore
Side-by-side diff
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/atconfigdialog.cpp182
-rw-r--r--noncore/apps/opie-console/atconfigdialog.h68
-rw-r--r--noncore/apps/opie-console/btconfigwidget.cpp12
-rw-r--r--noncore/apps/opie-console/btconfigwidget.h2
-rw-r--r--noncore/apps/opie-console/default.cpp16
-rw-r--r--noncore/apps/opie-console/dialdialog.cpp95
-rw-r--r--noncore/apps/opie-console/dialdialog.h29
-rw-r--r--noncore/apps/opie-console/emulation_widget.h14
-rw-r--r--noncore/apps/opie-console/io_bt.cpp63
-rw-r--r--noncore/apps/opie-console/io_bt.h48
-rw-r--r--noncore/apps/opie-console/io_modem.cpp66
-rw-r--r--noncore/apps/opie-console/io_modem.h69
-rw-r--r--noncore/apps/opie-console/modemconfigwidget.cpp187
-rw-r--r--noncore/apps/opie-console/modemconfigwidget.h36
-rw-r--r--noncore/apps/opie-console/opie-console.pro20
15 files changed, 887 insertions, 20 deletions
diff --git a/noncore/apps/opie-console/atconfigdialog.cpp b/noncore/apps/opie-console/atconfigdialog.cpp
new file mode 100644
index 0000000..ef6d1ae
--- a/dev/null
+++ b/noncore/apps/opie-console/atconfigdialog.cpp
@@ -0,0 +1,182 @@
+
+#include <qlineedit.h>
+#include <qspinbox.h>
+#include <qlayout.h>
+#include <qcombobox.h>
+#include <qtabwidget.h>
+#include <qlabel.h>
+#include <qcombobox.h>
+#include <qscrollview.h>
+
+#include "atconfigdialog.h"
+
+
+ATConfigDialog::ATConfigDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
+ : QDialog( parent, name, modal, fl ) {
+
+
+ setCaption( tr( "Dialing parameter setup" ) );
+
+ QVBoxLayout *layout = new QVBoxLayout( this );
+ QTabWidget *tabWidget = new QTabWidget( this );
+
+ tabWidget->addTab( tab0( this ), tr("Settings1") );
+ tabWidget->addTab( tab1( this ), tr("Settings2") );
+
+ layout->addWidget( tabWidget );
+
+}
+
+QWidget* ATConfigDialog::tab0( QWidget* parent) {
+
+
+ QScrollView* sv = new QScrollView( parent );
+
+ QWidget *returnWidget = new QWidget( sv->viewport() );
+ sv->setResizePolicy( QScrollView::AutoOneFit );
+// sv->setHScrollBarMode( QScrollView::AlwaysOff );
+// sv->setFrameShape( QFrame::NoFrame );
+
+
+
+
+ QGridLayout *layout = new QGridLayout( returnWidget, 10, 2 );
+
+ QLabel *initStringLabel = new QLabel( tr("Init string "), returnWidget );
+ initStringLine = new QLineEdit( returnWidget );
+ layout->addWidget( initStringLabel, 0, 0 );
+ layout->addWidget( initStringLine, 0, 1 );
+
+ QLabel *resetStringLabel = new QLabel( tr("Reset string "), returnWidget );
+ resetStringLine = new QLineEdit( returnWidget );
+ layout->addWidget( resetStringLabel, 1, 0 );
+ layout->addWidget( resetStringLine, 1, 1 );
+
+ QLabel *dialPref1Label = new QLabel( tr("Dialing prefix #1 " ), returnWidget );
+ dialPref1Line = new QLineEdit( returnWidget );
+ layout->addWidget( dialPref1Label, 2, 0 );
+ layout->addWidget( dialPref1Line, 2, 1 );
+
+ QLabel *dialSuf1Label = new QLabel( tr("Dialing suffix #1 " ), returnWidget );
+ dialSuf1Line = new QLineEdit( returnWidget );
+ layout->addWidget( dialSuf1Label, 3, 0 );
+ layout->addWidget( dialSuf1Line, 3, 1 );
+
+ QLabel *dialPref2Label = new QLabel( tr("Dialing prefix #2 " ), returnWidget );
+ dialPref2Line = new QLineEdit( returnWidget );
+ layout->addWidget( dialPref2Label, 4, 0 );
+ layout->addWidget( dialPref2Line, 4, 1 );
+
+ QLabel *dialSuf2Label = new QLabel( tr("Dialing suffix #2 " ), returnWidget );
+ dialSuf2Line = new QLineEdit( returnWidget );
+ layout->addWidget( dialSuf2Label, 5, 0 );
+ layout->addWidget( dialSuf2Line, 5, 1 );
+
+ QLabel *dialPref3Label = new QLabel( tr("Dialing prefix #3 " ), returnWidget );
+ dialPref3Line = new QLineEdit( returnWidget );
+ layout->addWidget( dialPref3Label, 6, 0 );
+ layout->addWidget( dialPref3Line, 6, 1 );
+
+ QLabel *dialSuf3Label = new QLabel( tr("Dialing suffix #3 " ), returnWidget );
+ dialSuf3Line = new QLineEdit( returnWidget );
+ layout->addWidget( dialSuf3Label, 7, 0 );
+ layout->addWidget( dialSuf3Line, 7, 1 );
+
+ QLabel *connectLabel = new QLabel( tr("Connect string " ), returnWidget );
+ connectLine = new QLineEdit( returnWidget );
+ layout->addWidget( connectLabel, 8, 0 );
+ layout->addWidget( connectLine, 8, 1 );
+
+ QLabel *hangupLabel = new QLabel( tr("Hang-up string " ), returnWidget );
+ hangupLine = new QLineEdit( returnWidget );
+ layout->addWidget( hangupLabel, 9, 0 );
+ layout->addWidget( hangupLine, 9, 1 );
+
+ sv->addChild( returnWidget );
+
+ return sv;
+
+}
+
+QWidget* ATConfigDialog::tab1( QWidget* parent ) {
+
+
+ QWidget *returnWidget = new QWidget( parent );
+
+ QGridLayout *layout = new QGridLayout( returnWidget, 8, 2 );
+
+ QLabel *dialTimeLabel = new QLabel( tr("Dial time " ), returnWidget );
+ dialTimeSpin = new QSpinBox( returnWidget );
+ layout->addWidget( dialTimeLabel, 0, 0 );
+ layout->addWidget( dialTimeSpin, 0, 1 );
+
+ QLabel *delayRedialLabel = new QLabel( tr("Delay before redial " ), returnWidget );
+ delayRedialSpin = new QSpinBox( returnWidget );
+ layout->addWidget( delayRedialLabel, 1, 0 );
+ layout->addWidget( delayRedialSpin, 1, 1 );
+
+ QLabel *numberTriesLabel = new QLabel( tr("Number of tries " ), returnWidget );
+ numberTriesSpin = new QSpinBox( returnWidget );
+ layout->addWidget( numberTriesLabel, 2, 0 );
+ layout->addWidget( numberTriesSpin, 2, 1 );
+
+ QLabel *dtrDropTimeLabel = new QLabel( tr("DTR drop time (0=no) " ), returnWidget );
+ dtrDropTimeSpin = new QSpinBox( returnWidget );
+ layout->addWidget( dtrDropTimeLabel, 3, 0 );
+ layout->addWidget( dtrDropTimeSpin, 3, 1 );
+
+ QLabel *bpsDetectLabel = new QLabel( tr("Auto bps detect " ), returnWidget );
+ bpsDetectBox = new QComboBox( returnWidget );
+ layout->addWidget( bpsDetectLabel, 4, 0 );
+ layout->addWidget( bpsDetectBox, 4, 1 );
+ bpsDetectBox->insertItem( tr("No") );
+ bpsDetectBox->insertItem( tr("Yes") );
+
+ QLabel *dcdLinesLabel = new QLabel( tr("Modem has DCD line " ), returnWidget );
+ dcdLinesBox = new QComboBox( returnWidget );
+ layout->addWidget( dcdLinesLabel, 5, 0 );
+ layout->addWidget( dcdLinesBox, 5, 1 );
+ dcdLinesBox->insertItem( tr("No") );
+ dcdLinesBox->insertItem( tr("Yes") );
+
+ QLabel *multiLineUntagLabel = new QLabel( tr("Multi-line untag " ), returnWidget );
+ multiLineUntagBox = new QComboBox( returnWidget );
+ layout->addWidget( multiLineUntagLabel, 6, 0 );
+ layout->addWidget( multiLineUntagBox, 6, 1 );
+ multiLineUntagBox->insertItem( tr("No") );
+ multiLineUntagBox->insertItem( tr("Yes") );
+
+ return returnWidget;
+
+}
+
+
+void ATConfigDialog::readConfig() {
+/*
+ initStringLine->setText( config.readEntry("InitString", MODEM_DEFAULT_INIT_STRING ) );
+ resetStringLine->setText( config.readEntry("ResetString", MODEM_DEFAULT_RESET_STRING ) );
+ dialPref1Line->setText( config.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 ) );
+ dialSuf1Line->setText( config.readEntry("DialSuffix1", MODEM_DEFAULT_DIAL_SUFFIX1 ) );
+ dialPref2Line->setText( config.readEntry("DialPrefix2", MODEM_DEFAULT_DIAL_PREFIX1 ) );
+ dialSuf2Line->setText( config.readEntry("DialSuffix2", MODEM_DEFAULT_DIAL_SUFFIX1 ) );
+ dialPref3Line->setText( config.readEntry("DialPrefix3", MODEM_DEFAULT_DIAL_PREFIX1 ) );
+ dialSuf3Line->setText( config.readEntry("DialSuffix3", MODEM_DEFAULT_DIAL_SUFFIX1 ) );
+ connectLine->setText( config.readEntry("DefaultConnect" MODEM_DEFAULT_CONNECT_STRING ) );
+ hangupLine->setText( config.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING ) );
+ dialTimeSpin;
+ delayRedialSpin;
+ numberTriesSpin;
+ dtrDropTimeSpin;
+ bpsDetectBox;
+ cdLinesBox;
+ multiLineUntagBox;
+*/
+}
+
+void ATConfigDialog::writeConfig() {
+
+}
+
+
+ATConfigDialog::~ATConfigDialog() {
+}
diff --git a/noncore/apps/opie-console/atconfigdialog.h b/noncore/apps/opie-console/atconfigdialog.h
new file mode 100644
index 0000000..47ff01d
--- a/dev/null
+++ b/noncore/apps/opie-console/atconfigdialog.h
@@ -0,0 +1,68 @@
+
+#ifndef ATCONFIGDIALOG_H
+#define ATCONFIGDIALOG_H
+
+#include <qdialog.h>
+
+#define MODEM_DEFAULT_INIT_STRING "~^M~ATZ^M~"
+#define MODEM_DEFAULT_RESET_STRING "~^M~ATZ^M~"
+#define MODEM_DEFAULT_DIAL_PREFIX1 "ATDT"
+#define MODEM_DEFAULT_DIAL_SUFFIX1 "^M"
+#define MODEM_DEFAULT_DIAL_PREFIX2 "ATDP"
+#define MODEM_DEFAULT_DIAL_SUFFIX2 "^M"
+#define MODEM_DEFAULT_DIAL_PREFIX3 "ATX1DT"
+#define MODEM_DEFAULT_DIAL_SUFFIX3 ";X4D^M"
+#define MODEM_DEFAULT_CONNECT_STRING "CONNECT"
+#define MODEM_DEFAULT_HANGUP_STRING "~~+++~~ATH^M"
+#define MODEM_DEFAULT_CANCEL_STRING "^M"
+#define MODEM_DEFAULT_DIAL_TIME 45
+#define MODEM_DEFAULT_DELAY_REDIAL 2
+#define MODEM_DEFAULT_NUMBER_TRIES 10
+#define MODEM_DEFAULT_DTR_DROP_TIME 1
+#define MODEM_DEFAULT_BPS_DETECT 0 // bool
+#define MODEM_DEFAULT_DCD_LINES 1 //bool
+#define MODEM_DEFAULT_MULTI_LINE_UNTAG 0 // bool
+
+class QLineEdit;
+class QSpinBox;
+class QComboBox;
+
+class ATConfigDialog : public QDialog {
+
+ Q_OBJECT
+
+public:
+ ATConfigDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
+
+ ~ATConfigDialog();
+
+ void readConfig();
+ void writeConfig();
+
+private:
+ QWidget *tab0( QWidget* parent);
+ QWidget *tab1( QWidget* parent);
+
+private:
+ QLineEdit *initStringLine;
+ QLineEdit *resetStringLine;
+ QLineEdit *dialPref1Line;
+ QLineEdit *dialSuf1Line;
+ QLineEdit *dialPref2Line;
+ QLineEdit *dialSuf2Line;
+ QLineEdit *dialPref3Line;
+ QLineEdit *dialSuf3Line;
+ QLineEdit *connectLine;
+ QLineEdit *hangupLine;
+ QSpinBox *dialTimeSpin;
+ QSpinBox *delayRedialSpin;
+ QSpinBox *numberTriesSpin;
+ QSpinBox *dtrDropTimeSpin;
+ QComboBox *bpsDetectBox;
+ QComboBox *dcdLinesBox;
+ QComboBox *multiLineUntagBox;
+
+};
+
+
+#endif
diff --git a/noncore/apps/opie-console/btconfigwidget.cpp b/noncore/apps/opie-console/btconfigwidget.cpp
index acc4811..eac6a79 100644
--- a/noncore/apps/opie-console/btconfigwidget.cpp
+++ b/noncore/apps/opie-console/btconfigwidget.cpp
@@ -1,5 +1,6 @@
#include <qlabel.h>
#include <qlayout.h>
+#include <qlineedit.h>
#include <qcombobox.h>
#include "iolayerbase.h"
@@ -29,10 +30,16 @@ BTConfigWidget::BTConfigWidget( const QString& name,
m_deviceCmb = new QComboBox(this );
m_deviceCmb->setEditable( TRUE );
+ QLabel *macLabel = new QLabel( this );
+ macLabel->setText( tr("Enter peer mac address here:") );
+ m_mac = new QLineEdit( this );
+
m_base = new IOLayerBase(this, "base");
m_lay->addWidget( m_device );
m_lay->addWidget( m_deviceCmb );
+ m_lay->addWidget( macLabel );
+ m_lay->addWidget( m_mac );
m_lay->addWidget( m_base );
m_deviceCmb->insertItem( "/dev/ttyU0" );
@@ -46,7 +53,11 @@ void BTConfigWidget::load( const Profile& prof ) {
int rad_flow = prof.readNumEntry("Flow");
int rad_parity = prof.readNumEntry("Parity");
int speed = prof.readNumEntry("Speed");
+ QString mac = prof.readEntry("Mac");
+ if (!mac.isEmpty() ) {
+ m_mac->setText( mac );
+ }
if (rad_flow == 1) {
m_base->setFlow( IOLayerBase::Hardware );
@@ -137,4 +148,5 @@ void BTConfigWidget::save( Profile& prof ) {
prof.writeEntry("Flow", flow);
prof.writeEntry("Parity", parity);
prof.writeEntry("Speed", speed);
+ prof.writeEntry("Mac", m_mac->text() );
}
diff --git a/noncore/apps/opie-console/btconfigwidget.h b/noncore/apps/opie-console/btconfigwidget.h
index 64190ad..ceb13ee 100644
--- a/noncore/apps/opie-console/btconfigwidget.h
+++ b/noncore/apps/opie-console/btconfigwidget.h
@@ -6,6 +6,7 @@
class QVBoxLayout;
class QLabel;
class QComboBox;
+class QLineEdit;
class IOLayerBase;
class BTConfigWidget : public ProfileDialogConnectionWidget {
@@ -22,6 +23,7 @@ private:
QLabel* m_device;
QComboBox* m_deviceCmb;
IOLayerBase* m_base;
+ QLineEdit* m_mac;
};
diff --git a/noncore/apps/opie-console/default.cpp b/noncore/apps/opie-console/default.cpp
index b092273..4853785 100644
--- a/noncore/apps/opie-console/default.cpp
+++ b/noncore/apps/opie-console/default.cpp
@@ -1,8 +1,11 @@
#include "io_serial.h"
+#include "io_irda.h"
+#include "io_bt.h"
#include "filetransfer.h"
#include "serialconfigwidget.h"
#include "irdaconfigwidget.h"
#include "btconfigwidget.h"
+#include "modemconfigwidget.h"
#include "terminalwidget.h"
#include "vt102emulation.h"
@@ -24,11 +27,11 @@ extern "C" {
IOLayer* newSerialLayer( const Profile& prof) {
return new IOSerial( prof );
}
- IOLayer* newBTLayer( const Profile& ) {
- return 0l;
+ IOLayer* newBTLayer( const Profile& prof ) {
+ return new IOBt( prof );
}
- IOLayer* newIrDaLayer( const Profile& ) {
- return 0l;
+ IOLayer* newIrDaLayer( const Profile& prof ) {
+ return new IOIrda( prof );
}
// Connection Widgets
@@ -38,10 +41,14 @@ extern "C" {
ProfileDialogWidget* newIrDaWidget( const QString& str, QWidget* wid ) {
return new IrdaConfigWidget( str, wid );
}
+ ProfileDialogWidget* newModemWidget( const QString& str, QWidget* wid ) {
+ return new ModemConfigWidget(str, wid );
+ }
ProfileDialogWidget* newBTWidget( const QString& str, QWidget* wid ) {
return new BTConfigWidget(str, wid );
}
+
// Terminal Widget(s)
ProfileDialogWidget* newTerminalWidget(const QString& na, QWidget* wid) {
return new TerminalWidget(na, wid,0 );
@@ -65,6 +72,7 @@ Default::Default( MetaFactory* fact ) {
fact->addConnectionWidgetFactory( "serial", QObject::tr("Serial"), newSerialWidget );
fact->addConnectionWidgetFactory( "irda", QObject::tr("Infrared"), newIrDaWidget );
+ fact->addConnectionWidgetFactory( "modem", QObject::tr("Modem"), newModemWidget );
fact->addConnectionWidgetFactory( "bt", QObject::tr("Bluetooth"), newBTWidget );
fact->addTerminalWidgetFactory( "default", QObject::tr("Default Terminal"), newTerminalWidget );
diff --git a/noncore/apps/opie-console/dialdialog.cpp b/noncore/apps/opie-console/dialdialog.cpp
new file mode 100644
index 0000000..8bf32f9
--- a/dev/null
+++ b/noncore/apps/opie-console/dialdialog.cpp
@@ -0,0 +1,95 @@
+
+
+#include <qlayout.h>
+#include <qlabel.h>
+#include <qcombobox.h>
+#include <qscrollview.h>
+#include <qpushbutton.h>
+#include <qfont.h>
+#include <qbuttongroup.h>
+
+#include "dialdialog.h"
+
+
+
+DialDialog::DialDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
+ : QDialog( parent, name, modal, fl ) {
+
+ m_number = 0;
+
+ setCaption( tr( "Enter number" ) );
+
+ QVBoxLayout *mainLayout = new QVBoxLayout( this );
+
+ QLabel *textLabel = new QLabel( this );
+ textLabel->setText( tr("Enter the number you want to dial. When finished, press ok") );
+
+ LCD = new QLCDNumber( this, "LCD" );
+ QFont LCD_font( LCD->font() );
+ LCD_font.setPointSize( 7 );
+ LCD->setFont( LCD_font );
+ LCD->setNumDigits( 25 );
+ LCD->setSegmentStyle( QLCDNumber::Flat );
+ LCD->setMaximumHeight( 30 );
+
+ QGridLayout *layout = new QGridLayout( this , 4, 3 );
+
+ QButtonGroup *dialButtons = new QButtonGroup( );
+
+ QPushButton *number0 = new QPushButton( this );
+ number0->setText( QString( "0" ) );
+ QFont number0_font( number0->font() );
+ number0_font.setBold( TRUE );
+ number0->setFont( number0_font );
+ layout->addWidget( number0, 4, 1 );
+ dialButtons->insert( number0 );
+
+ int x = 0, y = 0;
+ for ( int i = 0 ; i < 9; i++ ) {
+ QPushButton *number = new QPushButton( this );
+ number->setText( QString( "%1" ).arg( i + 1 ) );
+ QFont number_font( number->font() );
+ number_font.setBold( TRUE );
+ number->setFont( number_font );
+
+ dialButtons->insert( number );
+
+ layout->addWidget( number, x, y );
+
+ if ( y < 2 ) {
+ y++;
+ } else {
+ x++;
+ y = 0;
+ }
+ }
+
+ connect( dialButtons, SIGNAL( clicked( int ) ), this, SLOT( slotEnterNumber( int ) ) );
+
+ mainLayout->addStretch( 0 );
+ mainLayout->addWidget( textLabel );
+ mainLayout->addWidget( LCD );
+ mainLayout->addStretch( 0 );
+ mainLayout->addLayout( layout );
+ mainLayout->addStretch( 0 );
+
+
+}
+
+
+void DialDialog::slotEnterNumber( int number ) {
+
+ // pretty stupid, just for testing .-)
+
+ m_number = ( m_number * 10 ) + number;
+ qDebug( QString("%1").arg( m_number ) );
+ LCD->display( m_number );
+
+}
+
+DialDialog::~DialDialog() {
+}
+
+QString DialDialog::number() {
+ return QString( "%1").arg( m_number );
+}
diff --git a/noncore/apps/opie-console/dialdialog.h b/noncore/apps/opie-console/dialdialog.h
new file mode 100644
index 0000000..5c5b948
--- a/dev/null
+++ b/noncore/apps/opie-console/dialdialog.h
@@ -0,0 +1,29 @@
+
+#ifndef DIALDIALOG_H
+#define DIALDIALOG_H
+
+#include <qdialog.h>
+#include <qstring.h>
+#include <qlcdnumber.h>
+
+class DialDialog : public QDialog {
+
+ Q_OBJECT
+
+public:
+ DialDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
+
+ ~DialDialog();
+
+ QString number();
+
+private:
+ float m_number;
+ QLCDNumber *LCD;
+
+private slots:
+ void slotEnterNumber( int );
+};
+
+
+#endif
diff --git a/noncore/apps/opie-console/emulation_widget.h b/noncore/apps/opie-console/emulation_widget.h
index a57803d..56ea15f 100644
--- a/noncore/apps/opie-console/emulation_widget.h
+++ b/noncore/apps/opie-console/emulation_widget.h
@@ -35,18 +35,18 @@ public:
~EmulationWidget();
/**
- * sets the image
+ * sets the image
* @param QArray<Character> const newimg, the new image
* @param int lines, lines of the new image
* @param int columns, columns of the new image
*/
- virtual void setImage( QArray<Character> const newimg, int columns, int lines );
+ virtual void setImage( QArray<Character> const newimg, int columns, int lines ) {};
/**
* reloads configuration
* @param const Profile& config, configuration
*/
- virtual void reloadConfig( const Profile& config );
+ virtual void reloadConfig( const Profile& config ) {};
/**
* sets the scrollbar (not yet implemented)
@@ -60,11 +60,11 @@ public:
virtual void scroll( int value );
protected:
-
+
/**
* calculates current image bounds
*/
- virtual void calcGeometry();
+ virtual void calcGeometry() {};
/**
* draws a String
@@ -72,9 +72,9 @@ protected:
* @param QPainter& painter, painter, that should draw
* @param QRect rect, rect to be drawn into
* @param Character attr, attributes of Characters
- * @param bool usePixmap, if to use the background pixmap (currently not supported)
+ * @param bool usePixmap, if to use the background pixmap (currently not supported)
* @param bool clear, if rect should be cleared
*/
void drawAttrString( QString& string, QPainter& painter, QRect rect, Character attr, bool pm, bool clear );
-};
+};
diff --git a/noncore/apps/opie-console/io_bt.cpp b/noncore/apps/opie-console/io_bt.cpp
new file mode 100644
index 0000000..8bff4df
--- a/dev/null
+++ b/noncore/apps/opie-console/io_bt.cpp
@@ -0,0 +1,63 @@
+
+#include "io_bt.h"
+
+IOBt::IOBt( const Profile &config ) : IOSerial( config ) {
+ m_attach = 0;
+}
+
+
+IOBt::~IOBt() {
+ if ( m_attach ) {
+ delete m_attach;
+ }
+}
+
+
+void IOBt::close() {
+
+ IOSerial::close();
+ // still need error handling
+ delete m_attach;
+}
+
+bool IOBt::open() {
+
+ // hciattach here
+ m_attach = new OProcess();
+ *m_attach << "hciattach /dev/ttyS2 any 57600";
+
+ // then start hcid, then rcfomm handling (m_mac)
+
+ connect( m_attach, SIGNAL( processExited( OProcess* ) ),
+ this, SLOT( slotExited( OProcess* ) ) );
+
+ if ( m_attach->start() ) {
+ IOSerial::open();
+ } else {
+ qWarning("could not attach to device");
+ delete m_attach;
+ }
+}
+
+void IOBt::reload( const Profile &config ) {
+ m_device = config.readEntry("Device", BT_DEFAULT_DEVICE);
+ m_mac = config.readEntry("Mac", BT_DEFAULT_MAC);
+ m_baud = config.readNumEntry("Baud", BT_DEFAULT_BAUD);
+ m_parity = config.readNumEntry("Parity", BT_DEFAULT_PARITY);
+ m_dbits = config.readNumEntry("DataBits", BT_DEFAULT_DBITS);
+ m_sbits = config.readNumEntry("StopBits", BT_DEFAULT_SBITS);
+ m_flow = config.readNumEntry("Flow", BT_DEFAULT_FLOW);
+}
+
+
+QString IOBt::identifier() const {
+ return "bluetooth";
+}
+
+QString IOBt::name() const {
+ return "BLuetooth IO Layer";
+}
+
+void IOBt::slotExited( OProcess* proc ){
+ close();
+}
diff --git a/noncore/apps/opie-console/io_bt.h b/noncore/apps/opie-console/io_bt.h
new file mode 100644
index 0000000..5e9988c
--- a/dev/null
+++ b/noncore/apps/opie-console/io_bt.h
@@ -0,0 +1,48 @@
+#ifndef OPIE_IO_BT
+#define OPIE_IO_BT
+
+#include <opie/oprocess.h>
+#include "io_serial.h"
+
+/* Default values to be used if the profile information is incomplete */
+#define BT_DEFAULT_DEVICE "/dev/ttyU0"
+#define BT_DEFAULT_BAUD 9600
+#define BT_DEFAULT_PARITY 0
+#define BT_DEFAULT_DBITS 8
+#define BT_DEFAULT_SBITS 1
+#define BT_DEFAULT_FLOW 0
+#define BT_DEFAULT_MAC 0
+
+
+/* IOSerial implements a RS232 IO Layer */
+
+class IOBt : public IOSerial {
+
+ Q_OBJECT
+
+public:
+
+ IOBt(const Profile &);
+ ~IOBt();
+
+ QString identifier() const;
+ QString name() const;
+
+signals:
+ void received(const QByteArray &);
+ void error(int, const QString &);
+
+public slots:
+ bool open();
+ void close();
+ void reload(const Profile &);
+
+private:
+ OProcess *m_attach;
+ QString m_mac;
+private slots:
+ void slotExited(OProcess* proc);
+
+};
+
+#endif /* OPIE_IO_IRDA */
diff --git a/noncore/apps/opie-console/io_modem.cpp b/noncore/apps/opie-console/io_modem.cpp
new file mode 100644
index 0000000..4d6035d
--- a/dev/null
+++ b/noncore/apps/opie-console/io_modem.cpp
@@ -0,0 +1,66 @@
+
+#include "io_modem.h"
+
+IOModem:IOModem( const Profile &config ) : IOSerial( config ) {
+
+}
+
+
+IOModem::~IOModem() {
+
+}
+
+
+void IOModem::close() {
+
+ IOSerial::close();
+
+}
+
+bool IOModem::open() {
+
+
+ IOSerial::open();
+
+}
+
+void IOModem::reload( const Profile &config ) {
+ m_device = config.readEntry("Device", MODEM_DEFAULT_DEVICE);
+ m_baud = config.readNumEntry("Baud", MODEM_DEFAULT_BAUD);
+ m_parity = config.readNumEntry("Parity", MODEM_DEFAULT_PARITY);
+ m_dbits = config.readNumEntry("DataBits", MODEM_DEFAULT_DBITS);
+ m_sbits = config.readNumEntry("StopBits", MODEM_DEFAULT_SBITS);
+ m_flow = config.readNumEntry("Flow", MODEM_DEFAULT_FLOW);
+
+ m_initString = config.readEntry("InitString", MODEM_DEFAULT_INIT_STRING );
+ m_resetString = config.readEntry("ResetString", MODEM_DEFAULT_RESET_STRING );
+ m_dialPref1 = config.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 );
+ m_dialSuf1 = config.readEntry("DialSuffix1", MODEM_DEFAULT_DIAL_SUFFIX1 );
+ m_dialPref2 = config.readEntry("DialPrefix2", MODEM_DEFAULT_DIAL_PREFIX1 );
+ m_dialSuf2 = config.readEntry("DialSuffix2", MODEM_DEFAULT_DIAL_SUFFIX1 );
+ m_dialPref3 = config.readEntry("DialPrefix3", MODEM_DEFAULT_DIAL_PREFIX1 );
+ m_dialSuf3 = config.readEntry("DialSuffix3", MODEM_DEFAULT_DIAL_SUFFIX1 );
+ m_connect = config.readEntry("DefaultConnect" MODEM_DEFAULT_CONNECT_STRING );
+ m_hangup = config.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING );
+ m_cancel = config.readEntry("CancelString" MODEM_DEFAULT_CANCEL_STRING );
+ m_dialTime = config.readEntry("DialTime" MODEM_DEFAULT_DIAL_TIME );
+ m_delayRedial = config.readEntry("DelayRedial", MODEM_DEFAULT_DELAY_REDIAL );
+ m_numberTries = config.readEntry("NumberTries", MODEM_DEFAULT_NUMBER_TRIES );
+ m_dtrDropTime = config.readEntry("DTRDRopTime", MODEM_DEFAULT_DTR_DROP_TIME );
+ m_bpsDetect = config.readEntry("BPSDetect", MODEM_DEFAULT_BPS_DETECT );
+ m_dcdLines = config.readEntry("DCDLines", MODEM_DEFAULT_DCD_LINES );
+ m_multiLineUntag = config.readEntry("MultiLineUntag", MODEM_DEFAULT_MULTI_LINE_UNTAG );
+}
+
+
+QString IOModem::identifier() const {
+ return "modem";
+}
+
+QString IOModem::name() const {
+ return "Modem IO Layer";
+}
+
+void IOIrda::slotExited(OProcess* proc ){
+ close();
+}
diff --git a/noncore/apps/opie-console/io_modem.h b/noncore/apps/opie-console/io_modem.h
new file mode 100644
index 0000000..f155eb1
--- a/dev/null
+++ b/noncore/apps/opie-console/io_modem.h
@@ -0,0 +1,69 @@
+#ifndef OPIE_IO_MODEM
+#define OPIE_IO_MODEM
+
+#include <opie/oprocess.h>
+#include "io_serial.h"
+
+/* Default values to be used if the profile information is incomplete */
+#define MODEM_DEFAULT_DEVICE "/dev/ttyS0"
+#define MODEM_DEFAULT_BAUD 9600
+#define MODEM_DEFAULT_PARITY 0
+#define MODEM_DEFAULT_DBITS 8
+#define MODEM_DEFAULT_SBITS 1
+#define MODEM_DEFAULT_FLOW 0
+
+#define MODEM_DEFAULT_INIT_STRING "~^M~ATZ^M~"
+#define MODEM_DEFAULT_RESET_STRING "~^M~ATZ^M~"
+#define MODEM_DEFAULT_DIAL_PREFIX1 "ATDT"
+#define MODEM_DEFAULT_DIAL_SUFFIX1 "^M"
+#define MODEM_DEFAULT_DIAL_PREFIX2 "ATDP"
+#define MODEM_DEFAULT_DIAL_SUFFIX2 "^M"
+#define MODEM_DEFAULT_DIAL_PREFIX3 "ATX1DT"
+#define MODEM_DEFAULT_DIAL_SUFFIX3 ";X4D^M"
+#define MODEM_DEFAULT_CONNECT_STRING "CONNECT"
+#define MODEM_DEFAULT_HANGUP_STRING "~~+++~~ATH^M"
+#define MODEM_DEFAULT_CANCEL_STRING "^M"
+#define MODEM_DEFAULT_DIAL_TIME 45
+#define MODEM_DEFAULT_DELAY_REDIAL 2
+#define MODEM_DEFAULT_NUMBER_TRIES 10
+#define MODEM_DEFAULT_DTR_DROP_TIME 1
+#define MODEM_DEFAULT_BPS_DETECT 0 // bool
+#define MODEM_DEFAULT_DCD_LINES 1 //bool
+#define MODEM_DEFAULT_MULTI_LINE_UNTAG 0 // bool
+
+/* IOSerial implements a RS232 IO Layer */
+
+class IOModem : public IOSerial {
+
+ Q_OBJECT
+
+public:
+
+ IOModem(const Profile &);
+ ~IOModem();
+
+ QString identifier() const;
+ QString name() const;
+
+signals:
+ void received(const QByteArray &);
+ void error(int, const QString &);
+
+public slots:
+ bool open();
+ void close();
+ void reload(const Profile &);
+
+private:
+
+ QString m_initString, m_resetString, m_dialPref1, m_dialSuf1, m_dialPref2,
+ m_dialSuf2, dialPref3, m_dialSuf3, m_connect, m_hangup, m_cancel;
+ int m_dialTime, m_delayRedial, m_numberTries, m_dtrDropTime,
+ m_bpsDetect, m_dcdLines, m_multiLineUntag;
+
+private slots:
+ void slotExited(OProcess* proc);
+
+};
+
+#endif
diff --git a/noncore/apps/opie-console/modemconfigwidget.cpp b/noncore/apps/opie-console/modemconfigwidget.cpp
new file mode 100644
index 0000000..0968f62
--- a/dev/null
+++ b/noncore/apps/opie-console/modemconfigwidget.cpp
@@ -0,0 +1,187 @@
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qcombobox.h>
+#include <qlineedit.h>
+#include <qpushbutton.h>
+#include <qhbox.h>
+
+#include "iolayerbase.h"
+#include "modemconfigwidget.h"
+#include "atconfigdialog.h"
+#include "dialdialog.h"
+
+namespace {
+ void setCurrent( const QString& str, QComboBox* bo ) {
+ uint b = bo->count();
+ for (uint i = 0; i < bo->count(); i++ ) {
+ if ( bo->text(i) == str ) {
+ bo->setCurrentItem( i );
+ return;
+ }
+ }
+ bo->insertItem( str );
+ bo->setCurrentItem( b );
+ }
+}
+
+ModemConfigWidget::ModemConfigWidget( const QString& name,
+ QWidget* parent,
+ const char* na )
+ : ProfileDialogConnectionWidget( name, parent, na ) {
+
+ m_lay = new QVBoxLayout(this );
+ m_device = new QLabel(tr("Modem is attached to:"), this );
+ m_deviceCmb = new QComboBox(this );
+ m_deviceCmb->setEditable( TRUE );
+
+ QLabel* telLabel = new QLabel( this );
+ telLabel->setText( tr("Enter telefon number here:") );
+ m_telNumber = new QLineEdit( this );
+ QHBox *buttonBox = new QHBox( this );
+ QPushButton *atButton = new QPushButton( buttonBox );
+ atButton->setText( tr("AT commands") );
+ connect( atButton, SIGNAL( clicked() ), this, SLOT( slotAT() ) );
+
+ QPushButton *dialButton = new QPushButton( buttonBox );
+ dialButton->setText( tr("Enter number") );
+ connect( dialButton, SIGNAL( clicked() ), this, SLOT( slotDial() ) );
+
+
+ m_base = new IOLayerBase(this, "base");
+
+ m_lay->addWidget( m_device );
+ m_lay->addWidget( m_deviceCmb );
+ m_lay->addWidget( telLabel );
+ m_lay->addWidget( m_telNumber );
+ m_lay->addWidget( buttonBox );
+ m_lay->addWidget( m_base );
+
+ m_deviceCmb->insertItem( "/dev/ttyS0" );
+ m_deviceCmb->insertItem( "/dev/ttyS1" );
+ m_deviceCmb->insertItem( "/dev/ttyS2" );
+
+
+}
+
+ModemConfigWidget::~ModemConfigWidget() {
+
+}
+void ModemConfigWidget::load( const Profile& prof ) {
+
+ int rad_flow = prof.readNumEntry("Flow");
+ int rad_parity = prof.readNumEntry("Parity");
+ int speed = prof.readNumEntry("Speed");
+ QString number = prof.readEntry("Number");
+
+ if (!number.isEmpty() ) {
+ m_telNumber->setText( number );
+ }
+
+ if (rad_flow == 1) {
+ m_base->setFlow( IOLayerBase::Hardware );
+ } else if (rad_flow == 2) {
+ m_base->setFlow( IOLayerBase::Software );
+ } else if (rad_flow == 0) {
+ m_base->setFlow( IOLayerBase::None );
+ }
+
+ if (rad_parity == 1) {
+ m_base->setParity( IOLayerBase::Even );
+ } else {
+ m_base->setParity( IOLayerBase::Odd );
+ }
+
+ switch( speed ) {
+ case 115200:
+ m_base->setSpeed(IOLayerBase::Baud_115200 );
+ break;
+ case 57600:
+ m_base->setSpeed( IOLayerBase::Baud_57600 );
+ break;
+ case 38400:
+ m_base->setSpeed(IOLayerBase::Baud_38400 );
+ break;
+ case 19200:
+ m_base->setSpeed( IOLayerBase::Baud_19200 );
+ break;
+ case 9600:
+ default:
+ m_base->setSpeed(IOLayerBase::Baud_9600 );
+ break;
+ }
+
+ if ( prof.readEntry("Device").isEmpty() ) return;
+ setCurrent( prof.readEntry("Device"), m_deviceCmb );
+
+}
+/*
+ * save speed,
+ * flow,
+ * parity
+ */
+void ModemConfigWidget::save( Profile& prof ) {
+ int flow, parity, speed;
+ prof.writeEntry("Device", m_deviceCmb->currentText() );
+
+
+ switch( m_base->flow() ) {
+ case IOLayerBase::None:
+ flow = 0;
+ break;
+ case IOLayerBase::Software:
+ flow = 2;
+ break;
+ case IOLayerBase::Hardware:
+ flow = 1;
+ break;
+ }
+
+ switch( m_base->parity() ) {
+ case IOLayerBase::Odd:
+ parity = 2;
+ break;
+ case IOLayerBase::Even:
+ parity = 1;
+ break;
+ }
+
+ switch( m_base->speed() ) {
+ case IOLayerBase::Baud_115200:
+ speed = 115200;
+ break;
+ case IOLayerBase::Baud_57600:
+ speed = 57600;
+ break;
+ case IOLayerBase::Baud_38400:
+ speed = 38400;
+ break;
+ case IOLayerBase::Baud_19200:
+ speed = 19200;
+ break;
+ case IOLayerBase::Baud_9600:
+ speed = 9600;
+ break;
+ }
+
+ prof.writeEntry("Flow", flow);
+ prof.writeEntry("Parity", parity);
+ prof.writeEntry("Speed", speed);
+ prof.writeEntry("Number", m_telNumber->text() );
+}
+
+void ModemConfigWidget::slotAT() {
+ ATConfigDialog conf( this, "ATConfig", true );
+ conf.readConfig();
+ conf.showMaximized();
+ if ( conf.exec() == QDialog::Accepted ) {
+ conf.writeConfig();
+ }
+}
+
+void ModemConfigWidget::slotDial() {
+ DialDialog dial( this, "DialConfig", true );
+ dial.showMaximized();
+ if ( dial.exec() == QDialog::Accepted ) {
+ m_telNumber->setText( dial.number() );
+ }
+}
diff --git a/noncore/apps/opie-console/modemconfigwidget.h b/noncore/apps/opie-console/modemconfigwidget.h
new file mode 100644
index 0000000..1363f78
--- a/dev/null
+++ b/noncore/apps/opie-console/modemconfigwidget.h
@@ -0,0 +1,36 @@
+#ifndef OPIE_MODEM_CONFIG_WIDGET_H
+#define OPIE_MODEM_CONFIG_WIDGET_H
+
+#include "profiledialogwidget.h"
+
+
+class QVBoxLayout;
+class QLabel;
+class QComboBox;
+class QLineEdit;
+class IOLayerBase;
+class ModemConfigWidget : public ProfileDialogConnectionWidget {
+
+ Q_OBJECT
+
+public:
+ ModemConfigWidget( const QString& name, QWidget* parent, const char* name = 0l );
+ ~ModemConfigWidget();
+
+ void load( const Profile& );
+ void save( Profile& );
+private:
+ QVBoxLayout* m_lay;
+ QLabel* m_device;
+ QComboBox* m_deviceCmb;
+ IOLayerBase* m_base;
+ QLineEdit* m_telNumber;
+
+
+private slots:
+ void slotAT();
+ void slotDial();
+};
+
+
+#endif
diff --git a/noncore/apps/opie-console/opie-console.pro b/noncore/apps/opie-console/opie-console.pro
index 9208042..ccc3079 100644
--- a/noncore/apps/opie-console/opie-console.pro
+++ b/noncore/apps/opie-console/opie-console.pro
@@ -2,7 +2,7 @@ TEMPLATE = app
#CONFIG = qt warn_on release
CONFIG = qt debug
DESTDIR = $(OPIEDIR)/bin
-HEADERS = io_layer.h io_serial.h io_irda.h \
+HEADERS = io_layer.h io_serial.h io_irda.h io_bt.h\
file_layer.h filetransfer.h \
metafactory.h \
session.h \
@@ -26,11 +26,12 @@ HEADERS = io_layer.h io_serial.h io_irda.h \
default.h \
terminalwidget.h \
iolayerbase.h \
- serialconfigwidget.h irdaconfigwidget.h btconfigwidget.h \
- emulation_widget.h procctl.h
+ serialconfigwidget.h irdaconfigwidget.h \
+ btconfigwidget.h modemconfigwidget.h \
+ atconfigdialog.h dialdialog.h \
+ emulation_widget.h procctl.h \
-
-SOURCES = io_layer.cpp io_serial.cpp io_irda.cpp \
+SOURCES = io_layer.cpp io_serial.cpp io_irda.cpp io_bt.cpp \
file_layer.cpp filetransfer.cpp \
main.cpp \
metafactory.cpp \
@@ -50,12 +51,13 @@ SOURCES = io_layer.cpp io_serial.cpp io_irda.cpp \
transferdialog.cpp \
profiledialogwidget.cpp \
profileeditordialog.cpp \
- default.cpp \
terminalwidget.cpp \
iolayerbase.cpp \
- serialconfigwidget.cpp irdaconfigwidget.cpp btconfigwidget.cpp \
- emulation_widget.cpp procctl.cpp
-
+ serialconfigwidget.cpp irdaconfigwidget.cpp \
+ btconfigwidget.cpp modemconfigwidget.cpp \
+ atconfigdialog.cpp dialdialog.cpp \
+ emulation_widget.cpp default.cpp procctl.cpp \
+
INTERFACES = configurebase.ui editbase.ui
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include