summaryrefslogtreecommitdiff
path: root/core/obex/btobex.cpp
Unidiff
Diffstat (limited to 'core/obex/btobex.cpp') (more/less context) (show whitespace changes)
-rw-r--r--core/obex/btobex.cpp60
1 files changed, 46 insertions, 14 deletions
diff --git a/core/obex/btobex.cpp b/core/obex/btobex.cpp
index a5bfe5f..212a084 100644
--- a/core/obex/btobex.cpp
+++ b/core/obex/btobex.cpp
@@ -1 +1,31 @@
1/*
2               =. This file is part of the OPIE Project
3             .=l. Copyright (c) 2002 Maximilian Reiss <max.reiss@gmx.de>
4           .>+-=
5 _;:,     .>    :=|. This library is free software; you can
6.> <,   >  .   <= redistribute it and/or modify it under
7:=1 )Y*s>-.--   : the terms of the GNU Library General Public
8.="- .-=="i,     .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; version 2 of the License.
10     ._= =}       :
11    .%+i>       _;_.
12    .i_,=:_.      -<s. This library is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=| MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>: PARTICULAR PURPOSE. See the GNU
17..}^=.=       =       ; Library General Public License for more
18++=   -.     .     .: details.
19 :     =  ...= . :.=-
20 -.   .:....=;==+<; You should have received a copy of the GNU
21  -_. . .   )=.  = Library General Public License along with
22   --        :-= this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA.
26
27*/
28/*
29 * The Bluetooth OBEX manipulating class implementation
30 */
1 31
@@ -22,3 +52,3 @@ using namespace OpieTooth;
22BtObex::BtObex( QObject *parent, const char* name ) 52BtObex::BtObex( QObject *parent, const char* name )
23 : QObject(parent, name ) 53 : ObexBase(parent, name )
24{ 54{
@@ -26,8 +56,2 @@ BtObex::BtObex( QObject *parent, const char* name )
26 m_send=0; 56 m_send=0;
27 m_count = 0;
28 m_receive = false;
29 connect( this, SIGNAL(error(int) ), // for recovering to receive
30 SLOT(slotError() ) );
31 connect( this, SIGNAL(sent(bool) ),
32 SLOT(slotError() ) );
33 btManager = NULL; 57 btManager = NULL;
@@ -42,8 +66,7 @@ BtObex::~BtObex() {
42void BtObex::receive() { 66void BtObex::receive() {
43 m_receive = true; 67 ObexBase::receive();
44 m_outp = QString::null; 68 m_rec = new ObexServer();
45 m_rec = new OProcess();
46 69
70 odebug << "BT OBEX do receive" << oendl;
47 // TODO mbhaynie: No idea if this actually works -- maybe opd is better. 71 // TODO mbhaynie: No idea if this actually works -- maybe opd is better.
48 *m_rec << "obexftpd" << "-b";
49 // connect to the necessary slots 72 // connect to the necessary slots
@@ -63,6 +86,4 @@ void BtObex::receive() {
63void BtObex::send( const QString& fileName, const QString& bdaddr) { 86void BtObex::send( const QString& fileName, const QString& bdaddr) {
87 ObexBase::send(fileName, bdaddr);
64 // if currently receiving stop it send receive 88 // if currently receiving stop it send receive
65 m_count = 0;
66 m_file = fileName;
67 m_bdaddr = bdaddr;
68 if (m_send != 0) { 89 if (m_send != 0) {
@@ -152,2 +173,6 @@ void BtObex::sendNow(){
152 173
174 /*
175 * FIXME: this delay is made because some cell phones understands an error
176 * later.
177 */
153 ::sleep(4); 178 ::sleep(4);
@@ -173,2 +198,3 @@ void BtObex::slotExited(OProcess* proc ){
173 received(); 198 received();
199
174} 200}
@@ -179,2 +205,4 @@ void BtObex::slotStdOut(OProcess* proc, char* buf, int len){
179 m_outp.append( ar ); 205 m_outp.append( ar );
206 QCString str(buf, len);
207 odebug << str << oendl;
180 } 208 }
@@ -209,2 +237,3 @@ void BtObex::received() {
209 QString filename = parseOut(); 237 QString filename = parseOut();
238 odebug << "OBEX " << filename << " received" << oendl;
210 emit receivedFile( filename ); 239 emit receivedFile( filename );
@@ -242,2 +271,3 @@ QString BtObex::parseOut(){
242void BtObex::slotError() { 271void BtObex::slotError() {
272 ObexBase::slotError();
243 if ( m_receive ) 273 if ( m_receive )
@@ -246,2 +276,4 @@ void BtObex::slotError() {
246void BtObex::setReceiveEnabled( bool receive ) { 276void BtObex::setReceiveEnabled( bool receive ) {
277 odebug << "BT OBEX setReceiveEnabled " << receive << oendl;
278 ObexBase::setReceiveEnabled(receive);
247 if ( !receive ) { // 279 if ( !receive ) { //