summaryrefslogtreecommitdiff
path: root/noncore/net/opietooth/lib/startpanconnection.cpp
authorharlekin <harlekin>2003-03-21 15:56:58 (UTC)
committer harlekin <harlekin>2003-03-21 15:56:58 (UTC)
commitd3f71dadbd2dafcf42480afeffe75e7e36ec7d9c (patch) (unidiff)
tree922b36110df58bdc00a3e2508313609c0f00c45f /noncore/net/opietooth/lib/startpanconnection.cpp
parent69086f42072e7fc1ea5256cb9275a27bf5b41f87 (diff)
downloadopie-d3f71dadbd2dafcf42480afeffe75e7e36ec7d9c.zip
opie-d3f71dadbd2dafcf42480afeffe75e7e36ec7d9c.tar.gz
opie-d3f71dadbd2dafcf42480afeffe75e7e36ec7d9c.tar.bz2
move connection work to the lib
Diffstat (limited to 'noncore/net/opietooth/lib/startpanconnection.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/lib/startpanconnection.cpp67
1 files changed, 67 insertions, 0 deletions
diff --git a/noncore/net/opietooth/lib/startpanconnection.cpp b/noncore/net/opietooth/lib/startpanconnection.cpp
new file mode 100644
index 0000000..b68f02d
--- a/dev/null
+++ b/noncore/net/opietooth/lib/startpanconnection.cpp
@@ -0,0 +1,67 @@
1
2#include "startpanconnection.h"
3
4using namespace OpieTooth;
5
6
7StartPanConnection::StartPanConnection() {
8 m_panConnect = 0l;
9 setConnectionType();
10}
11
12StartPanConnection::~StartPanConnection() {
13 delete m_panConnect;
14}
15
16StartPanConnection::StartPanConnection( QString mac ) {
17 m_panConnect = 0l;
18 m_mac = mac;
19 setConnectionType();
20}
21
22void StartPanConnection::setName( QString name ) {
23 m_name = name;
24}
25
26QString StartPanConnection::name() {
27 return m_name;
28}
29
30void StartPanConnection::setConnectionType() {
31 m_connectionType = Pan;
32}
33
34StartConnection::ConnectionType StartPanConnection::type() {
35 return m_connectionType;
36}
37
38void StartPanConnection::start() {
39 m_panConnect = new OProcess();
40 *m_panConnect << "pand" << "--connect" << m_mac;
41
42 connect( m_panConnect, SIGNAL( processExited( OProcess* ) ) ,
43 this, SLOT( slotExited( OProcess* ) ) );
44 connect( m_panConnect, SIGNAL( receivedStdout( OProcess*, char*, int ) ),
45 this, SLOT( slotStdOut( OProcess*, char*, int ) ) );
46 if (!m_panConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) {
47 qWarning( "could not start" );
48 delete m_panConnect;
49 }
50}
51
52
53void StartPanConnection::slotExited( OProcess* proc ) {
54 delete m_panConnect;
55}
56
57void StartPanConnection::slotStdOut(OProcess* proc, char* chars, int len)
58{}
59
60
61void StartPanConnection::stop() {
62 if ( m_panConnect ) {
63 delete m_panConnect;
64 m_panConnect = 0l;
65 }
66}
67