summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/io_irda.cpp
Side-by-side diff
Diffstat (limited to 'noncore/apps/opie-console/io_irda.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/io_irda.cpp60
1 files changed, 60 insertions, 0 deletions
diff --git a/noncore/apps/opie-console/io_irda.cpp b/noncore/apps/opie-console/io_irda.cpp
new file mode 100644
index 0000000..8e31e82
--- a/dev/null
+++ b/noncore/apps/opie-console/io_irda.cpp
@@ -0,0 +1,60 @@
+
+#include "io_irda.h"
+
+IOIrda::IOIrda( const Profile &config ) : IOSerial( config ) {
+ m_attach = 0;
+}
+
+
+IOIrda::~IOIrda() {
+ if ( m_attach ) {
+ delete m_attach;
+ }
+}
+
+
+void IOIrda::close() {
+
+ IOSerial::close();
+ // still need error handling
+ delete m_attach;
+}
+
+bool IOIrda::open() {
+
+ // irdaattach here
+ m_attach = new OProcess();
+ *m_attach << "irattach /dev/ttyS2 -s";
+
+ 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 IOIrda::reload( const Profile &config ) {
+ m_device = config.readEntry("Device", IRDA_DEFAULT_DEVICE);
+ m_baud = config.readNumEntry("Baud", IRDA_DEFAULT_BAUD);
+ m_parity = config.readNumEntry("Parity", IRDA_DEFAULT_PARITY);
+ m_dbits = config.readNumEntry("DataBits", IRDA_DEFAULT_DBITS);
+ m_sbits = config.readNumEntry("StopBits", IRDA_DEFAULT_SBITS);
+ m_flow = config.readNumEntry("Flow", IRDA_DEFAULT_FLOW);
+}
+
+
+QString IOIrda::identifier() const {
+ return "irda";
+}
+
+QString IOIrda::name() const {
+ return "Irda IO Layer";
+}
+
+void IOIrda::slotExited(OProcess* proc ){
+ close();
+}