×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    May 2003
    Posts
    16

    Sending multiple files over bluetooth from phone to PC

    We are at the moment dealing with file sends from the phone to a PC over Bluetooth. We used the below example and modified it for dealing with files instead of text, as some people here in the forum did. (thanks for that)
    \Symbian\7.0s\Series60_v21\Series60Ex\btobjectexchange\

    This is the object we are using for sending one file.

    CObexBufObject* CObjectExchangeClient::CreateObject(TInt filenumber)
    {
    RFs fs;
    RFile file;
    fs.Connect();

    _LIT(number1, "e:\\settings\\Settings.csv");
    _LIT(number2, "e:\\settings\\Settings2.csv");
    if (filenumber == 1)
    file.Open(fs,number1, EFileRead);
    else
    file.Open(fs,number2, EFileRead);
    TInt size;
    TUint8 *filedata;
    file.Size(size);
    filedata = new TUint8[size];

    //read data
    TPtr8 ptr(filedata, size, size);
    file.Read(ptr);
    file.Close();
    fs.Close();

    if (iBufFlat)
    iBufFlat = NULL;

    else
    iBufFlat = CBufFlat::NewL(size);

    iBufFlat->SetReserveL(size);
    iBufFlat->InsertL(0,filedata,size);

    if(iCurrObject)
    iCurrObject = NULL;

    else
    iCurrObject = CObexBufObject::NewL(iBufFlat);

    delete filedata;

    TParse f;
    f.Set(KCsvFileName, NULL, NULL);
    TBuf<256> name;
    name.Copy(f.NameAndExt());
    iCurrObject->SetNameL(name);


    return iCurrObject;
    }


    We are calling the SendObject-function from a buttonhandler. The iClient is defined as CObexClient* iClient.

    void CObjectExchangeClient::SendObjectL(TInt number)
    {
    if (iState != EWaitingToSend)
    {
    User::Leave(KErrDisconnected);
    }
    else if (IsActive())
    {
    User::Leave(KErrInUse);
    }
    iClient->Put(*CreateObject(number), iStatus);
    SetActive();
    }

    We know that create object works as we can send one file but When we're trying to call the SendObject-function again, from the button handler, to send a second file it crashes. We think/know it has something to do with the active object. Is it possible to send multiple files over bluetooth from the phone with the above example? If so, how can this be done. Thanks in advance!!!
    Kind Regards,
    Daniel and Ronan

  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,166
    maybe you could try sending the files with CSendAppUi. works pretty well and you can send as many files as you want.

    anyway, next time, try to include the full error description (i.e. the note shown, possible line that causes the error etc.), by just saying it crashes, will not give enough information for solving the problem, and demotivates people on offering possible solutions for the problem.

    yucca

  3. #3
    Super Contributor
    Join Date
    Apr 2003
    Location
    Czech Republic
    Posts
    915
    Exactly CSendAppUi::CreateAndSendMessageL() takes an array of files that are consequently send over chosen MTM (bluetooth for example).

  4. #4
    Registered User
    Join Date
    May 2003
    Posts
    16

    Problem solved

    Thanks for your replies. We managed to solve the problem by invoking the RunL functionality to send the next file.
    /Daniel & Ronan

  5. #5
    Super Contributor
    Join Date
    Apr 2003
    Location
    Czech Republic
    Posts
    915
    You may also want to check this simple example:

    http://kuca.webzdarma.cz/index.php3?...n&co=t7logtopc

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×