00001 #include <opie2/odebug.h>
00002
00003 #include "startdunconnection.h"
00004
00005 using namespace OpieTooth;
00006
00007
00008 using namespace Opie::Core;
00009 StartDunConnection::StartDunConnection() {
00010 m_dunConnect = 0l;
00011 setConnectionType();
00012 }
00013
00014 StartDunConnection::~StartDunConnection() {
00015 delete m_dunConnect;
00016 }
00017
00018 StartDunConnection::StartDunConnection( QString mac ) {
00019 m_dunConnect = 0l;
00020 m_mac = mac;
00021 setConnectionType();
00022 }
00023
00024 void StartDunConnection::setName( QString name ) {
00025 m_name = name;
00026 }
00027
00028 QString StartDunConnection::name() {
00029 return m_name;
00030 }
00031
00032 void StartDunConnection::setConnectionType() {
00033 m_connectionType = Pan;
00034 }
00035
00036 StartConnection::ConnectionType StartDunConnection::type() {
00037 return m_connectionType;
00038 }
00039
00040 void StartDunConnection::start() {
00041 m_dunConnect = new OProcess();
00042 *m_dunConnect << "dund" << "--listen" << "--connect" << m_mac;
00043
00044 connect( m_dunConnect, SIGNAL( processExited(Opie::Core::OProcess*) ) ,
00045 this, SLOT( slotExited(Opie::Core::OProcess*) ) );
00046 connect( m_dunConnect, SIGNAL( receivedStdout(Opie::Core::OProcess*,char*,int) ),
00047 this, SLOT( slotStdOut(Opie::Core::OProcess*,char*,int) ) );
00048 if (!m_dunConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) {
00049 owarn << "could not start" << oendl;
00050 delete m_dunConnect;
00051 }
00052 }
00053
00054
00055 void StartDunConnection::slotExited( OProcess* proc ) {
00056 delete m_dunConnect;
00057 }
00058
00059 void StartDunConnection::slotStdOut(OProcess* proc, char* chars, int len)
00060 {}
00061
00062
00063 void StartDunConnection::stop() {
00064 if ( m_dunConnect ) {
00065 delete m_dunConnect;
00066 m_dunConnect = 0l;
00067 }
00068 }
00069