-rw-r--r-- | core/obex/obex.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/core/obex/obex.cpp b/core/obex/obex.cpp index 95c561a..e4a3c31 100644 --- a/core/obex/obex.cpp +++ b/core/obex/obex.cpp | |||
@@ -12,98 +12,97 @@ | |||
12 | .i_,=:_. -<s. This library is distributed in the hope that | 12 | .i_,=:_. -<s. This library is distributed in the hope that |
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
14 | : .. .:, . . . without even the implied warranty of | 14 | : .. .:, . . . without even the implied warranty of |
15 | =_ + =;=| MERCHANTABILITY or FITNESS FOR A | 15 | =_ + =;=| MERCHANTABILITY or FITNESS FOR A |
16 | _.=:. : :=>: PARTICULAR PURPOSE. See the GNU | 16 | _.=:. : :=>: PARTICULAR PURPOSE. See the GNU |
17 | ..}^=.= = ; Library General Public License for more | 17 | ..}^=.= = ; Library General Public License for more |
18 | ++= -. . .: details. | 18 | ++= -. . .: details. |
19 | : = ...= . :.=- | 19 | : = ...= . :.=- |
20 | -. .:....=;==+<; You should have received a copy of the GNU | 20 | -. .:....=;==+<; You should have received a copy of the GNU |
21 | -_. . . )=. = Library General Public License along with | 21 | -_. . . )=. = Library General Public License along with |
22 | -- :-= this library; see the file COPYING.LIB. | 22 | -- :-= this library; see the file COPYING.LIB. |
23 | If not, write to the Free Software Foundation, | 23 | If not, write to the Free Software Foundation, |
24 | Inc., 59 Temple Place - Suite 330, | 24 | Inc., 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | /* | 28 | /* |
29 | * The Infrared OBEX handling class implementation | 29 | * The Infrared OBEX handling class implementation |
30 | */ | 30 | */ |
31 | 31 | ||
32 | #include "obex.h" | 32 | #include "obex.h" |
33 | 33 | ||
34 | /* OPIE */ | 34 | /* OPIE */ |
35 | #include <opie2/oprocess.h> | 35 | #include <opie2/oprocess.h> |
36 | #include <opie2/odebug.h> | 36 | #include <opie2/odebug.h> |
37 | 37 | ||
38 | /* QT */ | 38 | /* QT */ |
39 | #include <qfileinfo.h> | 39 | #include <qfileinfo.h> |
40 | 40 | ||
41 | 41 | ||
42 | 42 | ||
43 | using namespace OpieObex; | 43 | using namespace OpieObex; |
44 | 44 | ||
45 | using namespace Opie::Core; | 45 | using namespace Opie::Core; |
46 | /* TRANSLATOR OpieObex::Obex */ | 46 | /* TRANSLATOR OpieObex::Obex */ |
47 | 47 | ||
48 | Obex::Obex( QObject *parent, const char* name ) | 48 | Obex::Obex( QObject *parent, const char* name ) |
49 | : ObexBase(parent, name ) | 49 | : ObexBase(parent, name ) |
50 | { | 50 | { |
51 | m_rec = 0; | 51 | m_rec = 0; |
52 | m_send=0; | 52 | m_send=0; |
53 | }; | 53 | }; |
54 | Obex::~Obex() { | 54 | Obex::~Obex() { |
55 | delete m_rec; | 55 | delete m_rec; |
56 | delete m_send; | 56 | delete m_send; |
57 | } | 57 | } |
58 | void Obex::receive() { | 58 | void Obex::receive() { |
59 | ObexBase::receive(); | 59 | ObexBase::receive(); |
60 | m_rec = new OProcess(); | 60 | m_rec = new ObexServer(OBEX_TRANS_IRDA); |
61 | *m_rec << "irobex_palm3"; | ||
62 | // connect to the necessary slots | 61 | // connect to the necessary slots |
63 | connect(m_rec, SIGNAL(processExited(Opie::Core::OProcess*) ), | 62 | connect(m_rec, SIGNAL(processExited(Opie::Core::OProcess*) ), |
64 | this, SLOT(slotExited(Opie::Core::OProcess*) ) ); | 63 | this, SLOT(slotExited(Opie::Core::OProcess*) ) ); |
65 | 64 | ||
66 | connect(m_rec, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int ) ), | 65 | connect(m_rec, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int ) ), |
67 | this, SLOT(slotStdOut(Opie::Core::OProcess*, char*, int) ) ); | 66 | this, SLOT(slotStdOut(Opie::Core::OProcess*, char*, int) ) ); |
68 | 67 | ||
69 | if(!m_rec->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { | 68 | if(!m_rec->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { |
70 | emit done( false ); | 69 | emit done( false ); |
71 | delete m_rec; | 70 | delete m_rec; |
72 | m_rec = 0; | 71 | m_rec = 0; |
73 | } | 72 | } |
74 | } | 73 | } |
75 | 74 | ||
76 | // if currently receiving stop it send receive | 75 | // if currently receiving stop it send receive |
77 | void Obex::send(const QString& fileName, const QString& addr) { | 76 | void Obex::send(const QString& fileName, const QString& addr) { |
78 | ObexBase::send(fileName, addr); | 77 | ObexBase::send(fileName, addr); |
79 | if (m_rec != 0 ) { | 78 | if (m_rec != 0 ) { |
80 | if (m_rec->isRunning() ) { | 79 | if (m_rec->isRunning() ) { |
81 | emit error(-1 ); | 80 | emit error(-1 ); |
82 | delete m_rec; | 81 | delete m_rec; |
83 | m_rec = 0; | 82 | m_rec = 0; |
84 | 83 | ||
85 | }else{ | 84 | }else{ |
86 | emit error( -1 ); // we did not delete yet but it's not running slotExited is pending | 85 | emit error( -1 ); // we did not delete yet but it's not running slotExited is pending |
87 | return; | 86 | return; |
88 | } | 87 | } |
89 | } | 88 | } |
90 | sendNow(); | 89 | sendNow(); |
91 | } | 90 | } |
92 | void Obex::sendNow(){ | 91 | void Obex::sendNow(){ |
93 | if ( m_count >= 25 ) { // could not send | 92 | if ( m_count >= 25 ) { // could not send |
94 | emit error(-1 ); | 93 | emit error(-1 ); |
95 | emit sent(false); | 94 | emit sent(false); |
96 | return; | 95 | return; |
97 | } | 96 | } |
98 | // OProcess inititialisation | 97 | // OProcess inititialisation |
99 | m_send = new OProcess(); | 98 | m_send = new OProcess(); |
100 | m_send->setWorkingDirectory( QFileInfo(m_file).dirPath(true) ); | 99 | m_send->setWorkingDirectory( QFileInfo(m_file).dirPath(true) ); |
101 | 100 | ||
102 | *m_send << "irobex_palm3"; | 101 | *m_send << "irobex_palm3"; |
103 | *m_send << QFile::encodeName(QFileInfo(m_file).fileName()); | 102 | *m_send << QFile::encodeName(QFileInfo(m_file).fileName()); |
104 | 103 | ||
105 | // connect to slots Exited and and StdOut | 104 | // connect to slots Exited and and StdOut |
106 | connect(m_send, SIGNAL(processExited(Opie::Core::OProcess*) ), | 105 | connect(m_send, SIGNAL(processExited(Opie::Core::OProcess*) ), |
107 | this, SLOT(slotExited(Opie::Core::OProcess*)) ); | 106 | this, SLOT(slotExited(Opie::Core::OProcess*)) ); |
108 | connect(m_send, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int )), | 107 | connect(m_send, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int )), |
109 | this, SLOT(slotStdOut(Opie::Core::OProcess*, char*, int) ) ); | 108 | this, SLOT(slotStdOut(Opie::Core::OProcess*, char*, int) ) ); |