Wireless Communication Library Support Forum

Frameworks => Bluetooth Framework => Topic started by: Raj on June 04, 2008, 08:36:16 AM

Title: Get Multiple Files
Post by: Raj on June 04, 2008, 08:36:16 AM
Hi

I am using WCL.net lite. I am trying to get all files from my mobile listed under one folder.

when I loop through the files and get , an error is thrown like asynchronous process in progress.
Please let me know how I could do that.


private void btnGetAllFiles_Click(object sender, EventArgs e)
        {
            if (lvFTP.Items.Count > 0 )           
            {
                //Loop all items.
                for (int i = 0; i < lvFTP.Items.Count; i++)
                {
                    if (lvFTP.Items.SubItems[1].Text == "File")
                    {
                        strFileName = lvFTP.Items[0].Text;
                        wclFTPClient.Get(lvFTP.Items[0].Text);
                    }
                }
            }
           
        }
Title: Re: Get Multiple Files
Post by: Mike Petrichenko on June 04, 2008, 10:18:30 AM
Get is asynchroniouse operation. When file received OnGetCOmplete event fires. Only after that you can get other file.
Title: Re: Get Multiple Files
Post by: Raj on June 04, 2008, 11:01:42 AM
I know that, problem is "get" method is asynchronously callig the delegate "wclFTPClient_GetComplete" but didn't notify for the completion of event,

Can you please suggest me that is there any class or method by which I can get all the files at one event.

can I make multiple instances of wclFTPClient, and fire them.

Please let me know
Title: Re: Get Multiple Files
Post by: Mike Petrichenko on June 04, 2008, 12:56:31 PM
There is no way to get file files by one call.
Title: Re: Get Multiple Files
Post by: Raj on June 04, 2008, 02:13:50 PM
how can i get the multiple files ?
Do I need to call wclFTPClient.Get() multiple times.

if yes then how will I know that GetCompleted event is fired ?
Please suggest me something.
Title: Re: Get Multiple Files
Post by: Mike Petrichenko on June 04, 2008, 04:17:49 PM
Yes, you need to call Get multiple times.

Does the event fire in Demo app?
Title: Re: Get Multiple Files
Post by: Raj on June 10, 2008, 11:02:07 AM
I have call dir function from end event of get function.

Thanks for ur support.
Title: Re: Get Multiple Files
Post by: conatwill on September 26, 2008, 04:59:16 AM
Since the Get is asynchroniouse operation, so how does the Put work? Sometimes, the Put block and the cpu occupancy is up to almost 100%, why? How dose the wcl lead to this case?My code as follows(the connection is ok):


            this.wclFTPClient = new wclnet.wclFTPClient();
            this.wclFTPClient.AutoDetect = true;
            this.wclFTPClient.ClientTransport = wclnet.wclClientTransport.ctBluetooth;
            this.wclFTPClient.Target = new System.Guid("f9ec7bc4-953c-11d2-984e-525400dc9e09");
                    //Create the stream
                    Stream FileStream = null;
                    try
                    {
                        FileStream = new FileStream(filename, FileMode.Open);
                        wclFTPClient.Put(filename, FileStream);
                    }
                    finally
                    {
                        if (FileStream != null)
                        {
                            FileStream.Close();
                            FileStream = null;
                        }
                    }

Best Regards!
Title: Re: Get Multiple Files
Post by: Mike Petrichenko on September 26, 2008, 07:28:08 AM
Good day!

Pus is async as well. You do not need close the stream immeditally. Wait when OnComplete even fires and then release the stream.
Title: Re: Get Multiple Files
Post by: conatwill on September 26, 2008, 07:34:21 AM
      I copy code from the wcl demo as follows, and in this function, the stream is also closed after Put, so what's the problem? and in which cases, the Put will block and make the cpu occupancy up to 100%?

  private void btFTPPut_Click(object sender, EventArgs e)
        {
            if (OpenDialog.ShowDialog() == DialogResult.OK)
            {
                Stream Stream = new FileStream(OpenDialog.FileName, FileMode.Open);

                try
                {
                    String AFile = System.IO.Path.GetFileName(OpenDialog.FileName);
                    wclFTPClient.Put(AFile, Stream);
                }
                finally
                {
                    Stream.Close();
                    Stream = null;
                }
            }
        }
Title: Re: Get Multiple Files
Post by: Mike Petrichenko on September 26, 2008, 08:54:39 AM
What is bluetooth drivers?
Title: Re: Get Multiple Files
Post by: conatwill on September 26, 2008, 09:15:54 AM
The bluedriver is Widcomm, and another strange question is : When I list files of the remote server(my pda),  an null file existin the folder,and this file has the same name as the folder which includes it but the size of it is 0, and each foler opend has the file of this type, when I get it, the wcl show the error : access point error and exit, After I check the remote device, there is no this file;

Thanks for your reply.
Title: Re: Get Multiple Files
Post by: Mike Petrichenko on September 26, 2008, 09:54:42 AM
Thanks for the report. I will check and fix asap
Title: Re: Get Multiple Files
Post by: Raj on October 20, 2008, 05:31:21 PM
Hi Mike,

Thanks for your valuable answers.

First, I am able to make different connect simultaneously as well as I am getting the files from those active connections.

Mike, I need to know, that may I attach a custom object/tag/value with wclFTPClient Object ?
One thing more the transfer rate of file is two slow, i am checking the different and glot wclObexParam class, in that i checked Param Size, can we change these param size.

wclOBEXParams objwclOBEXParams = new wclOBEXParams();
 objwclOBEXParams.PacketSize = ????

can we make chages like this to make file transfer fast ?


Title: Re: Get Multiple Files
Post by: Mike Petrichenko on October 20, 2008, 05:56:12 PM
Of course yu can change it and it may help. But actually the transfering speed hard depend on the hardware.
Title: Re: Get Multiple Files
Post by: Raj on October 21, 2008, 06:43:06 AM
Hi Mike,

you said, I can change the buffer and param's packet size, but when I am changing the buffer and param package size then it throws me the error for read only property.

Below is the code.

wclBuffers objBuffers = new wclBuffers();
            objBuffers.ReadBuffer = 4096;
            objBuffers.WriteBuffer = 4096;

            objFtpClient.Buffers = objBuffers;
            objFtpClient.Param = objParam;

Kindly suggest me something, if it possible ?

Title: Re: Get Multiple Files
Post by: Mike Petrichenko on October 21, 2008, 07:45:24 AM
objFtpClient.Buffers.ReadBuffer = 4096;
objFtpClient.Buffers.WriteBuffer = 4096;
objFtpClient.Params.PacketSize = 4096;
Title: Re: Get Multiple Files
Post by: Raj on October 21, 2008, 07:51:46 AM
I have tried this,
but no luch  :(

no change in speed.

Can you suggest me the best hardware dongle, to make bluetooth transfer rate faster.

currently I am using BlueSoleil 2.1.3.0 Voip Release
Stack Version 05.04.11.200600413


Title: Re: Get Multiple Files
Post by: Mike Petrichenko on October 21, 2008, 08:26:30 AM
Update BlueSoleil to MS and it will work faster. How to do so:
http://www.btframework.com/faq.htm
http://www.vinsvision.com/Articles/tabid/66/EntryID/13/Default.aspx
Title: Re: Get Multiple Files
Post by: Raj on October 23, 2008, 06:33:11 AM
Hi Mike,

I am facing a strange problem, during wclFTPClient's Dir method e.filecount  is always 0, while mobile has the file. Please telll me the possible error due to I am facing this problem.


Title: Re: Get Multiple Files
Post by: Raj on October 23, 2008, 07:39:05 AM
Sorry !!!!!!!!!!!!

I have solved the problem.

I haven't set wclFtpClient.AutoDetect=true ;

But by the ways if I haven't set it is true, then what should be workaround to get the folder and file listing.

Title: Re: Get Multiple Files
Post by: Mike Petrichenko on October 23, 2008, 07:47:07 AM
No work around. You use nokia phone which does not provide access to the files with using FileTransferProfile. Nokia uses its own service. AutoDetect allows to detect which service to use.
Title: Re: Get Multiple Files
Post by: Raj on October 23, 2008, 09:11:38 AM
Thanks :)

Title: Re: Get Multiple Files
Post by: gusadolfo on June 04, 2009, 05:08:31 PM
Hi i know this topic is kinda old, but i have a problem sending multiple files and i was hoping you could help me out, here's the code (i'm using vb.net):
  
 Private Sub Send()
        BFObjectPushClientX.OpenDevice()
        If BFObjectPushClientX.Active Then
            Try
                For Each row As DataRow In _archives.Tables(0).Rows
                    BFObjectPushClientX.Put(My.Application.Info.DirectoryPath & "\" & K_FOLDER_CONTENT_TMP & "\" & row("Archive"))
                    _ws.ReportBluetoothDelivery(Password(), row("BuyId"), row("ItemId"), My.Settings.User)
                Next
            Catch ex As Exception
                Dim oErr As New cError(ex)
                _frmMsg = New frmMessage("Can't deliver all files", eMessageType.Info, False)
                _frmMsg.ShowDialog()
            End Try
        Else
            _frmMsg = New frmMessaje("Unable to connect", eMessageType.Info, False)
            _frmMsg.ShowDialog()
        End If
                BFObjectPushClientX.Close()
    End Sub

End Class

it only sends one file at the time.
Title: Re: Get Multiple Files
Post by: Mike Petrichenko on June 04, 2009, 05:37:59 PM
How should it be?
Title: Re: Get Multiple Files
Post by: gusadolfo on June 04, 2009, 06:04:26 PM
it should be able to send multiple files, this isn't my code, the guy that was working here before me did it and i'm not sure if it is right, and i need the app to send multiple files if that's the case, i guess that's why he used

For Each row As DataRow In _archives.Tables(0).Rows
   BFObjectPushClientX.Put(My.Application.Info.DirectoryPath & "\" & K_FOLDER_CONTENT_TMP & "\" & row("Archive"))
   _ws.ReportBluetoothDelivery(Password(), row("BuyId"), row("ItemId"), My.Settings.User)
Next

right? for each row in the _archives.Tables it should send a file
Title: Re: Get Multiple Files
Post by: Mike Petrichenko on June 04, 2009, 06:11:22 PM
I don;t use VB in my development and it's a bit hard to understand what should it do. By the logic it should do so. But what do you mean on "Multiple files"? Per one Put operation? if yes - then it is impossible
Title: Re: Get Multiple Files
Post by: gusadolfo on June 04, 2009, 06:44:15 PM
what i'm trying to do is every time it enters the For it should select a different file from _archives.Tables(0).rows and send it, but it does it one time then it cancels the connection
Title: Re: Get Multiple Files
Post by: gusadolfo on June 04, 2009, 06:49:07 PM
i found what's wrong, don't worry it's in the stored procedure that reports the delivery where's throwing the exception, that's why it cancels the connection, thanks anyways!!