Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

startpanconnection.cpp

Go to the documentation of this file.
00001 #include <opie2/odebug.h>
00002 #include "startpanconnection.h"
00003 
00004 using namespace OpieTooth;
00005 
00006 
00007 using namespace Opie::Core;
00008 using namespace Opie::Core;
00009 StartPanConnection::StartPanConnection() {
00010     m_panConnect = 0l;
00011     setConnectionType();
00012 }
00013 
00014 StartPanConnection::~StartPanConnection() {
00015     delete m_panConnect;
00016 }
00017 
00018 StartPanConnection::StartPanConnection( QString mac )  {
00019     m_panConnect = 0l;
00020     m_mac = mac;
00021     setConnectionType();
00022 }
00023 
00024 void StartPanConnection::setName( QString name ) {
00025     m_name = name;
00026 }
00027 
00028 QString StartPanConnection::name()  {
00029     return m_name;
00030 }
00031 
00032 void StartPanConnection::setConnectionType() {
00033     m_connectionType = Pan;
00034 }
00035 
00036 StartConnection::ConnectionType StartPanConnection::type() {
00037     return m_connectionType;
00038 }
00039 
00040 void StartPanConnection::start()  {
00041     m_panConnect = new OProcess();
00042     odebug << "IM START " + m_mac << oendl; 
00043     *m_panConnect << "pand" << "--connect" << m_mac;
00044 
00045     connect( m_panConnect, SIGNAL( processExited(Opie::Core::OProcess*) ) ,
00046              this, SLOT( slotExited(Opie::Core::OProcess*) ) );
00047     connect( m_panConnect, SIGNAL( receivedStdout(Opie::Core::OProcess*,char*,int) ),
00048              this, SLOT( slotStdOut(Opie::Core::OProcess*,char*,int) ) );
00049     if (!m_panConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) {
00050         owarn << "could not start" << oendl; 
00051         delete m_panConnect;
00052     }
00053 }
00054 
00055 
00056 void StartPanConnection::slotExited( OProcess* proc ) {
00057     delete m_panConnect;
00058     m_panConnect = 0l;
00059 }
00060 
00061 void StartPanConnection::slotStdOut(OProcess* proc, char* chars, int len)
00062 {}
00063 
00064 
00065 void StartPanConnection::stop()  {
00066     if ( m_panConnect )  {
00067         delete m_panConnect;
00068         m_panConnect = 0l;
00069     }
00070     m_panConnect = new OProcess();
00071     odebug << "IM STOP " + m_mac << oendl; 
00072 
00073     *m_panConnect << "pand" << "--kill" << m_mac;
00074 
00075     connect( m_panConnect, SIGNAL( processExited(Opie::Core::OProcess*) ) ,
00076              this, SLOT( slotExited(Opie::Core::OProcess*) ) );
00077     connect( m_panConnect, SIGNAL( receivedStdout(Opie::Core::OProcess*,char*,int) ),
00078              this, SLOT( slotStdOut(Opie::Core::OProcess*,char*,int) ) );
00079     if (!m_panConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) {
00080         owarn << "could not stop" << oendl; 
00081         delete m_panConnect;
00082     }
00083 }
00084 

Generated on Sat Nov 5 16:17:43 2005 for OPIE by  doxygen 1.4.2