Diffstat (limited to 'noncore/net/opietooth/lib/device.cc') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/opietooth/lib/device.cc | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/noncore/net/opietooth/lib/device.cc b/noncore/net/opietooth/lib/device.cc index e3d7f3b..5234996 100644 --- a/noncore/net/opietooth/lib/device.cc +++ b/noncore/net/opietooth/lib/device.cc | |||
@@ -1,10 +1,10 @@ | |||
1 | 1 | ||
2 | #include <signal.h> | 2 | #include <signal.h> |
3 | 3 | ||
4 | #include "kprocess.h" | 4 | #include <opie/oprocess.h> |
5 | 5 | ||
6 | #include "device.h" | 6 | #include "device.h" |
7 | 7 | ||
8 | using namespace OpieTooth; | 8 | using namespace OpieTooth; |
9 | 9 | ||
10 | namespace { | 10 | namespace { |
@@ -37,23 +37,23 @@ Device::~Device(){ | |||
37 | } | 37 | } |
38 | void Device::attach(){ | 38 | void Device::attach(){ |
39 | qWarning("attaching %s %s", m_device.latin1(), m_mode.latin1() ); | 39 | qWarning("attaching %s %s", m_device.latin1(), m_mode.latin1() ); |
40 | if(m_process == 0 ){ | 40 | if(m_process == 0 ){ |
41 | m_output.resize(0); | 41 | m_output.resize(0); |
42 | qWarning("new process to create" ); | 42 | qWarning("new process to create" ); |
43 | m_process = new KProcess(); | 43 | m_process = new OProcess(); |
44 | *m_process << "hciattach"; | 44 | *m_process << "hciattach"; |
45 | *m_process << "-p"; | 45 | *m_process << "-p"; |
46 | *m_process << m_device << m_mode; | 46 | *m_process << m_device << m_mode; |
47 | connect(m_process, SIGNAL( processExited(KProcess*) ), | 47 | connect(m_process, SIGNAL( processExited(OProcess*) ), |
48 | this, SLOT( slotExited(KProcess* ) ) ); | 48 | this, SLOT( slotExited(OProcess* ) ) ); |
49 | connect(m_process, SIGNAL( receivedStdout(KProcess*, char*, int) ), | 49 | connect(m_process, SIGNAL( receivedStdout(OProcess*, char*, int) ), |
50 | this, SLOT(slotStdOut(KProcess*,char*,int ) ) ); | 50 | this, SLOT(slotStdOut(OProcess*,char*,int ) ) ); |
51 | connect(m_process, SIGNAL(receivedStderr(KProcess*, char*, int ) ), | 51 | connect(m_process, SIGNAL(receivedStderr(OProcess*, char*, int ) ), |
52 | this, SLOT(slotStdErr(KProcess*,char*,int) ) ); | 52 | this, SLOT(slotStdErr(OProcess*,char*,int) ) ); |
53 | if(!m_process->start(KProcess::NotifyOnExit, KProcess::AllOutput ) ){ | 53 | if(!m_process->start(OProcess::NotifyOnExit, OProcess::AllOutput ) ){ |
54 | qWarning("Could not start" ); | 54 | qWarning("Could not start" ); |
55 | delete m_process; | 55 | delete m_process; |
56 | m_process = 0; | 56 | m_process = 0; |
57 | } | 57 | } |
58 | }; | 58 | }; |
59 | } | 59 | } |
@@ -71,13 +71,13 @@ void Device::detach(){ | |||
71 | bool Device::isLoaded()const{ | 71 | bool Device::isLoaded()const{ |
72 | return m_attached; | 72 | return m_attached; |
73 | } | 73 | } |
74 | QString Device::devName()const { | 74 | QString Device::devName()const { |
75 | return QString::fromLatin1("hci0"); | 75 | return QString::fromLatin1("hci0"); |
76 | }; | 76 | }; |
77 | void Device::slotExited( KProcess* proc) | 77 | void Device::slotExited( OProcess* proc) |
78 | { | 78 | { |
79 | qWarning("prcess exited" ); | 79 | qWarning("prcess exited" ); |
80 | if(proc== m_process ){ | 80 | if(proc== m_process ){ |
81 | if( m_process->normalExit() ){ // normal exit | 81 | if( m_process->normalExit() ){ // normal exit |
82 | int ret = m_process->exitStatus(); | 82 | int ret = m_process->exitStatus(); |
83 | if( ret == 0 ){ // attached | 83 | if( ret == 0 ){ // attached |
@@ -85,17 +85,17 @@ void Device::slotExited( KProcess* proc) | |||
85 | qWarning("Output: %s", m_output.data() ); | 85 | qWarning("Output: %s", m_output.data() ); |
86 | pid = parsePid( m_output ); | 86 | pid = parsePid( m_output ); |
87 | qWarning("Pid = %d", pid ); | 87 | qWarning("Pid = %d", pid ); |
88 | // now hciconfig hci0 up ( determine hciX FIXME) | 88 | // now hciconfig hci0 up ( determine hciX FIXME) |
89 | // and call hciconfig hci0 up | 89 | // and call hciconfig hci0 up |
90 | // FIXME hardcoded to hci0 now :( | 90 | // FIXME hardcoded to hci0 now :( |
91 | m_hci = new KProcess( ); | 91 | m_hci = new OProcess( ); |
92 | *m_hci << "hciconfig"; | 92 | *m_hci << "hciconfig"; |
93 | *m_hci << "hci0 up"; | 93 | *m_hci << "hci0 up"; |
94 | connect(m_hci, SIGNAL( processExited(KProcess*) ), | 94 | connect(m_hci, SIGNAL( processExited(OProcess*) ), |
95 | this, SLOT( slotExited(KProcess* ) ) ); | 95 | this, SLOT( slotExited(OProcess* ) ) ); |
96 | if(!m_hci->start() ){ | 96 | if(!m_hci->start() ){ |
97 | qWarning("could not start" ); | 97 | qWarning("could not start" ); |
98 | m_attached = false; | 98 | m_attached = false; |
99 | emit device("hci0", false ); | 99 | emit device("hci0", false ); |
100 | } | 100 | } |
101 | }else{ | 101 | }else{ |
@@ -122,21 +122,21 @@ void Device::slotExited( KProcess* proc) | |||
122 | } | 122 | } |
123 | }// normal exit | 123 | }// normal exit |
124 | delete m_hci; | 124 | delete m_hci; |
125 | m_hci = 0; | 125 | m_hci = 0; |
126 | } | 126 | } |
127 | } | 127 | } |
128 | void Device::slotStdOut(KProcess* proc, char* chars, int len) | 128 | void Device::slotStdOut(OProcess* proc, char* chars, int len) |
129 | { | 129 | { |
130 | qWarning("std out" ); | 130 | qWarning("std out" ); |
131 | if( len <1 ) | 131 | if( len <1 ) |
132 | return; | 132 | return; |
133 | if(proc == m_process ){ | 133 | if(proc == m_process ){ |
134 | QCString string( chars, len+1 ); // \0 == +1 | 134 | QCString string( chars, len+1 ); // \0 == +1 |
135 | qWarning("output: %s", string.data() ); | 135 | qWarning("output: %s", string.data() ); |
136 | m_output.append( string.data() ); | 136 | m_output.append( string.data() ); |
137 | } | 137 | } |
138 | } | 138 | } |
139 | void Device::slotStdErr(KProcess*, char*, int ) | 139 | void Device::slotStdErr(OProcess*, char*, int ) |
140 | { | 140 | { |
141 | qWarning("std err" ); | 141 | qWarning("std err" ); |
142 | } | 142 | } |