summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/manager/bticonloader.cpp1
-rw-r--r--noncore/net/opietooth/manager/hidpopup.cpp105
-rw-r--r--noncore/net/opietooth/manager/hidpopup.h43
-rw-r--r--noncore/net/opietooth/manager/manager.pro4
-rw-r--r--noncore/net/opietooth/manager/popuphelper.cpp1
-rw-r--r--noncore/net/opietooth/manager/stdpopups.cpp5
-rw-r--r--noncore/net/opietooth/manager/stdpopups.h1
7 files changed, 158 insertions, 2 deletions
diff --git a/noncore/net/opietooth/manager/bticonloader.cpp b/noncore/net/opietooth/manager/bticonloader.cpp
index 6bac256..c8a6dd4 100644
--- a/noncore/net/opietooth/manager/bticonloader.cpp
+++ b/noncore/net/opietooth/manager/bticonloader.cpp
@@ -28,8 +28,9 @@ namespace OpieTooth {
serviceIcons.insert( 4374 , "network_16"); // Network Access Point
serviceIcons.insert( 4361 , "phone_16"); // CordlessTelephony
serviceIcons.insert( 4362 , "audio_16"); // AudioSource
serviceIcons.insert( 4363 , "audio_16"); // AudioSink
+ serviceIcons.insert( 4388 , "other_16" ); //Human Interface Device
serviceIcons.insert( 4390 , "print_16" ); //HCR_Print
serviceIcons.insert( 4392 , "phone_16" ); //Common_ISDN_Access
serviceIcons.insert( 4609 , "network_16" ); //GenericNetworking
diff --git a/noncore/net/opietooth/manager/hidpopup.cpp b/noncore/net/opietooth/manager/hidpopup.cpp
new file mode 100644
index 0000000..98a2fb4
--- a/dev/null
+++ b/noncore/net/opietooth/manager/hidpopup.cpp
@@ -0,0 +1,105 @@
+/* $Id$ */
+/* PAN context menu */
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+#include <qpe/qcopenvelope_qws.h>
+#include <qmessagebox.h>
+#include <opie2/odebug.h>
+#include <opie2/oprocess.h>
+#include <qpe/qpeapplication.h>
+using namespace Opie::Core;
+
+#include <qtimer.h>
+#include "hidpopup.h"
+
+using namespace OpieTooth;
+
+/*
+ * c'tor init the QAction
+ */
+HidPopup::HidPopup(const OpieTooth::Services&, OpieTooth::BTDeviceItem* item) :
+ QPopupMenu() {
+
+ owarn << "HidPopup c'tor" << oendl;
+
+ m_item = item;
+ QAction* a;
+ QAction* c;
+
+ m_hidConnect = 0l;
+ /* connect action */
+
+ a = new QAction(); // so it's get deleted
+ a->setText( tr("connect") );
+ a->addTo( this );
+ connect( a, SIGNAL( activated() ), this, SLOT( slotConnect() ) );
+
+ c = new QAction();
+ c->setText( tr( "disconnect" ) );
+ c->addTo( this );
+ connect( c, SIGNAL( activated() ), this, SLOT( slotDisconnect() ) );
+
+};
+
+HidPopup::~HidPopup() {
+ delete m_hidConnect;
+}
+
+void HidPopup::slotConnect() {
+ odebug << "connect" << oendl;
+ m_hidConnect = new OProcess();
+ *m_hidConnect << "hidd" << "--connect" << m_item->mac();
+ connect(m_hidConnect,
+ SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int)),
+ this, SLOT(fillOutPut(Opie::Core::OProcess*, char*, int)));
+ connect(m_hidConnect,
+ SIGNAL(receivedStderr(Opie::Core::OProcess*, char*, int)),
+ this, SLOT(fillErr(Opie::Core::OProcess*, char*, int)));
+ connect(m_hidConnect,
+ SIGNAL(processExited(Opie::Core::OProcess*)),
+ this, SLOT(slotProcessExited(Opie::Core::OProcess*)));
+ if (!m_hidConnect->start(OProcess::Block, OProcess::AllOutput)) {
+ QMessageBox::critical(this, tr("HID Connection"),
+ tr("HID Connection\nto device ") + m_item->mac() + tr("\nfailed"));
+ delete m_hidConnect;
+ m_hidConnect = 0l;
+ }
+}
+
+void HidPopup::slotDisconnect() {
+ OProcess hidKill;
+ hidKill << "hidd" << "--kill" << m_item->mac();
+ hidKill.start(OProcess::DontCare, OProcess::NoCommunication);
+ sleep(1);
+ QMessageBox::information(this, tr("HID Disconnect"), tr("HID Disconnected"));
+}
+
+void HidPopup::fillOutPut( OProcess*, char* cha, int len ) {
+ QCString str(cha, len);
+ odebug << str << oendl;
+}
+
+void HidPopup::fillErr(OProcess*, char* buf, int len)
+{
+ QCString str(buf, len);
+ odebug << str << oendl;
+}
+
+void HidPopup::slotProcessExited(OProcess* proc) {
+ if (m_hidConnect->normalExit())
+ QMessageBox::information(this, tr("HID Connection"),
+ tr("HID Connect\nstarted"));
+ else
+ QMessageBox::critical(this, tr("HID Connection"),
+ tr("HID Connection\nto device ") + m_item->mac() + tr("\nfailed"));
+ delete m_hidConnect;
+ m_hidConnect = 0l;
+}
+
+//eof
diff --git a/noncore/net/opietooth/manager/hidpopup.h b/noncore/net/opietooth/manager/hidpopup.h
new file mode 100644
index 0000000..0c51919
--- a/dev/null
+++ b/noncore/net/opietooth/manager/hidpopup.h
@@ -0,0 +1,43 @@
+/* $Id$ */
+/* PAN context menu */
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+#ifndef HIDPOPUP_H
+#define HIDPOPUP_H
+
+#include <qpopupmenu.h>
+#include <qaction.h>
+#include <opie2/oprocess.h>
+#include <services.h>
+#include "btdeviceitem.h"
+
+namespace OpieTooth {
+
+ class HidPopup : public QPopupMenu {
+
+ Q_OBJECT
+
+ public:
+ HidPopup(const OpieTooth::Services&, OpieTooth::BTDeviceItem*);
+ ~HidPopup();
+
+ private:
+ QAction* m_push;
+ OpieTooth::BTDeviceItem *m_item;
+ Opie::Core::OProcess* m_hidConnect; //HID process
+ private slots:
+ void slotConnect();
+ void slotDisconnect();
+ void fillOutPut( Opie::Core::OProcess* pppDial, char* cha, int len );
+ void fillErr(Opie::Core::OProcess*, char*, int);
+ void slotProcessExited(Opie::Core::OProcess* proc);
+ };
+};
+
+#endif
diff --git a/noncore/net/opietooth/manager/manager.pro b/noncore/net/opietooth/manager/manager.pro
index 09bd10e..dc048c4 100644
--- a/noncore/net/opietooth/manager/manager.pro
+++ b/noncore/net/opietooth/manager/manager.pro
@@ -8,9 +8,9 @@ HEADERS = btconnectionitem.h btdeviceitem.h \
obexdialog.h obexftpdialog.h \
rfcommassigndialogimpl.h rfcommassigndialogitem.h \
devicehandler.h rfcpopup.h obexpopup.h obexftpopup.h \
rfcommhelper.h panpopup.h dunpopup.h rfcommconfhandler.h \
- servicesdialog.h btconfhandler.h
+ servicesdialog.h btconfhandler.h hidpopup.h
SOURCES = btconnectionitem.cpp btdeviceitem.cpp \
btserviceitem.cpp filelistitem.cpp stdpopups.cpp \
popuphelper.cpp main.cpp \
@@ -20,9 +20,9 @@ SOURCES = btconnectionitem.cpp btdeviceitem.cpp \
rfcommassigndialogimpl.cpp rfcommassigndialogitem.cpp \
obexdialog.cpp devicehandler.cpp \
rfcpopup.cpp obexpopup.cpp obexftpopup.cpp obexftpdialog.cpp \
rfcommhelper.cpp panpopup.cpp dunpopup.cpp rfcommconfhandler.cpp \
- servicesdialog.cpp btconfhandler.cpp
+ servicesdialog.cpp btconfhandler.cpp hidpopup.cpp
INCLUDEPATH += $(OPIEDIR)/include
INCLUDEPATH += $(OPIEDIR)/noncore/net/opietooth/lib
DEPENDPATH += $(OPIEDIR)/include
LIBS += -lqpe -lbluetooth -lopietooth1 -lopiecore2 -lopieui2 -lopenobex
diff --git a/noncore/net/opietooth/manager/popuphelper.cpp b/noncore/net/opietooth/manager/popuphelper.cpp
index b3d7aa5..66f42bc 100644
--- a/noncore/net/opietooth/manager/popuphelper.cpp
+++ b/noncore/net/opietooth/manager/popuphelper.cpp
@@ -32,5 +32,6 @@ void PopupHelper::init() {
insert( 4355, newRfcComPopup );
insert( 4357, newObexPushPopup );
insert( 4358, newObexFtpPopup );
insert( 4374, newPanPopup );
+ insert( 4388, newHidPopup );
}
diff --git a/noncore/net/opietooth/manager/stdpopups.cpp b/noncore/net/opietooth/manager/stdpopups.cpp
index f58d3a6..17a7002 100644
--- a/noncore/net/opietooth/manager/stdpopups.cpp
+++ b/noncore/net/opietooth/manager/stdpopups.cpp
@@ -3,8 +3,9 @@
#include "obexpopup.h"
#include "obexftpopup.h"
#include "panpopup.h"
#include "dunpopup.h"
+#include "hidpopup.h"
#include "stdpopups.h"
extern "C" {
@@ -24,6 +25,10 @@ extern "C" {
QPopupMenu* newDunPopup( const OpieTooth::Services& service, OpieTooth::BTDeviceItem* item ) {
return new OpieTooth::DunPopup(service, item);
}
+
+ QPopupMenu* newHidPopup( const OpieTooth::Services& service, OpieTooth::BTDeviceItem* item ) {
+ return new OpieTooth::HidPopup(service, item);
+ }
}
diff --git a/noncore/net/opietooth/manager/stdpopups.h b/noncore/net/opietooth/manager/stdpopups.h
index 3c361db..f1e1696 100644
--- a/noncore/net/opietooth/manager/stdpopups.h
+++ b/noncore/net/opietooth/manager/stdpopups.h
@@ -14,8 +14,9 @@ extern "C" {
QPopupMenu* newRfcComPopup( const OpieTooth::Services&, OpieTooth::BTDeviceItem* );
QPopupMenu* newObexPushPopup( const OpieTooth::Services&, OpieTooth::BTDeviceItem* );
QPopupMenu* newPanPopup( const OpieTooth::Services&, OpieTooth::BTDeviceItem* );
QPopupMenu* newDunPopup( const OpieTooth::Services&, OpieTooth::BTDeviceItem* );
+ QPopupMenu* newHidPopup( const OpieTooth::Services&, OpieTooth::BTDeviceItem* );
QPopupMenu* newObexFtpPopup( const OpieTooth::Services&, OpieTooth::BTDeviceItem* );
}
#endif