From 6d3a8eaf3b92f8eec9908eed91568342fac5de1d Mon Sep 17 00:00:00 2001 From: korovkin Date: Sat, 15 Apr 2006 16:03:19 +0000 Subject: Added default passkey writing to /etc/bluetooth/pin file. Added encrypt default passkey in edit line button. --- (limited to 'noncore') diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp index 9ec5bf8..924d191 100644 --- a/noncore/net/opietooth/manager/bluebase.cpp +++ b/noncore/net/opietooth/manager/bluebase.cpp @@ -53,6 +53,7 @@ using namespace Opie::Core; #include #include #include +#include /* STD */ #include @@ -94,6 +95,7 @@ BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) connect( m_localDevice, SIGNAL( signalStrength(const QString&,const QString&) ), this, SLOT( addSignalStrength(const QString&,const QString&) ) ); connect(runButton, SIGNAL(clicked()), this, SLOT(doForward())); + connect(encCheckBox, SIGNAL(toggled(bool)), this, SLOT(doEncrypt(bool))); // let hold be rightButtonClicked() QPEApplication::setStylusOperation( devicesView->viewport(), QPEApplication::RightOnHold); @@ -130,6 +132,7 @@ BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) serSpeed->insertItem(speeds[i].str); } serSpeed->setCurrentItem((sizeof(speeds) / sizeof(speeds[0])) - 1); + encCheckBox->setChecked(true); } /** @@ -173,7 +176,9 @@ void BlueBase::writeConfig() */ void BlueBase::writeToHciConfig() { + QFile pinFile("/etc/bluetooth/pin"); // /etc/bluetooth/pin file owarn << "writeToHciConfig" << oendl; + //Write /etc/bluetooth/hcid.conf file HciConfWrapper hciconf ( "/etc/bluetooth/hcid.conf" ); hciconf.load(); hciconf.setPinHelper( QPEApplication::qpeDir() + "bin/bluepin" ); @@ -183,6 +188,12 @@ void BlueBase::writeToHciConfig() hciconf.setPscan( m_enablePagescan ); hciconf.setIscan( m_enableInquiryscan ); hciconf.save(); + // Write /etc/bluetooth/pin (default PIN file) + pinFile.open(IO_WriteOnly | IO_Truncate); + pinFile.writeBlock(m_defaultPasskey, m_defaultPasskey.length()); + pinFile.writeBlock("\n", sizeof("\n")); + pinFile.flush(); + pinFile.close(); } @@ -740,4 +751,13 @@ void BlueBase::forwardExit(Opie::Core::OProcess* proc) runButton->setText("start gateway"); } +/** + * Encrypt entered passkey + * doit - do encryption of the key + */ +void BlueBase::doEncrypt(bool doit) +{ + passkeyLine->setEchoMode((doit)? QLineEdit::Password: QLineEdit::Normal); +} + //eof diff --git a/noncore/net/opietooth/manager/bluebase.h b/noncore/net/opietooth/manager/bluebase.h index 0128a88..9cbea56 100644 --- a/noncore/net/opietooth/manager/bluebase.h +++ b/noncore/net/opietooth/manager/bluebase.h @@ -94,6 +94,7 @@ namespace OpieTooth { void deviceActive( const QString& mac, bool connected ); void applyConfigChanges(); void doForward(); + void doEncrypt(bool); void forwardExit(Opie::Core::OProcess* proc); void addSignalStrength(); void addSignalStrength( const QString& mac, const QString& strengh ); diff --git a/noncore/net/opietooth/manager/bluetoothbase.ui b/noncore/net/opietooth/manager/bluetoothbase.ui index a5e2c6f..5539181 100644 --- a/noncore/net/opietooth/manager/bluetoothbase.ui +++ b/noncore/net/opietooth/manager/bluetoothbase.ui @@ -11,7 +11,7 @@ 0 0 - 268 + 273 368 @@ -19,7 +19,7 @@ caption Form1 - + margin 0 @@ -239,99 +239,110 @@ spacing 2 - - QPushButton + + QLabel name - configApplyButton + deviceNameLabel text - Apply + Device Name - - QCheckBox + + QLabel name - authCheckBox + passkeyLabel text - enable authentification + Default Passkey - - QCheckBox + + QLineEdit name - cryptCheckBox + deviceNameLine + + + QLineEdit - text - enable encryption + name + passkeyLine + + + echoMode + Password - + QCheckBox name - pagescanCheckBox + encCheckBox text - Enable Page scan + encrypt - + QCheckBox name - inquiryscanCheckBox + authCheckBox text - Enable Inquiry scan + enable authentification - - QLabel + + QCheckBox name - deviceNameLabel + cryptCheckBox text - Device Name + enable encryption - - QLabel + + QCheckBox name - passkeyLabel + pagescanCheckBox text - Default Passkey + Enable Page scan - - QLineEdit + + QCheckBox name - deviceNameLine + inquiryscanCheckBox + + + text + Enable Inquiry scan - - QLineEdit + + QPushButton name - passkeyLine + configApplyButton - echoMode - Password + text + Apply @@ -351,11 +362,11 @@ margin - 4 + 0 spacing - 2 + 0 QLabel @@ -383,11 +394,11 @@ margin - 0 + 4 spacing - 0 + 2 QGroupBox @@ -399,119 +410,74 @@ title Cell Forwarder - + + layoutMargin + + + layoutSpacing + + margin - 11 + 4 spacing - 6 + 2 - - QLayoutWidget + + QPushButton + + name + runButton + + + text + start gateway + + + + QLabel name - Layout9 + serDevLabel + + + text + Serial device: - - - margin - 0 - - - spacing - 6 - - - QLayoutWidget - - name - Layout5 - - - - margin - 0 - - - spacing - 6 - - - QLabel - - name - serDevLabel - - - text - Serial device: - - - - QLineEdit - - name - serDevName - - - - - - QLayoutWidget - - name - Layout6 - - - - margin - 0 - - - spacing - 6 - - - QLabel - - name - serSpeedLabel - - - text - Speed: - - - - QComboBox - - name - serSpeed - - - - - - QPushButton - - name - runButton - - - text - start gateway - - - - + + QLineEdit + + name + serDevName + + + + QComboBox + + name + serSpeed + + + + QLabel + + name + serSpeedLabel + + + text + Speed: + + + - + @@ -535,4 +501,22 @@ 789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758 + + Status + devicesView + PushButton2 + connectionsView + deviceNameLine + passkeyLine + encCheckBox + authCheckBox + cryptCheckBox + pagescanCheckBox + inquiryscanCheckBox + configApplyButton + rfcommBindButton + serDevName + serSpeed + runButton + -- cgit v0.9.0.2