Author Topic: problem with sending to multiple devices  (Read 19644 times)

pesare_ariyayi

  • Guest
problem with sending to multiple devices
« on: May 14, 2009, 07:52:07 PM »
hi
i make an array of wcloppclient and try to make a connection with them, i put the file as soon as connection is opened (connected event happened) but the problem is when i want to send to several devices, (mobile phones), they don't figure out what is the file type! they can't open it cuz file type is gone!! how can i solve this?

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: problem with sending to multiple devices
« Reply #1 on: May 14, 2009, 08:05:07 PM »
Show me the code how do you send the file

pesare_ariyayi

  • Guest
Re: problem with sending to multiple devices
« Reply #2 on: May 15, 2009, 08:18:25 PM »

Code: [Select]
class oppClient
   {
        int ID;
        public void oppClient(_ID)
        {
        ID=_ID
        }
    }

private oppClient[] wclOPPClient;
//devices would be "new" in constructor
       private void discoverDevices()
        {
            wclBluetoothRadio Radio = wclBluetoothDiscovery.EnumRadios()[0];
                        wclBluetoothDiscovery.Discovery(Radio);
        }
        private void wclBluetoothDiscovery_DiscoveryComplete(object sender, BluetoothDiscoveryCompleteEventArgs e)
        {
           
            if (e.Devices != null)
           {
                for (int i = 0; i < this.wclOPPClient.Count(); i++)
                    if (!this.wclOPPClient[i].Active)
                        this.Send(this.Devices,i);
               
            }
        }
        private void wclOPPClient_Connect(object sender, wclConnectEventArgs e)
        {
            int ID = ((oppClient)sender).ID;
            if (e.Result == 0)
            {
                this.prgrsBar[ID].situation = 4;
                this.wclOPPClient[ID].Put(txtbxFileSubject.Text, this.Stream);
            }
        }
        private void wclOPPClient_Complete(object sender, wclOBEXCompleteEventArgs e)
        {
            int ID = ((oppClient)sender).ID;
            this.prgrsBar[ID].situation = 2;           

            this.wclOPPClient[ID].Close();
        }

discovers,when completed opens the connection (send method), when connected put the object, when completed close the connection.
at first i thought its because of wclClient_Completed event, I thought this event raises exactly before putting is completed so it closes the connection little before it completes. but i found its raised when the putting is completed by testing on sending to my mobile phone device. could you help me?

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: problem with sending to multiple devices
« Reply #3 on: May 16, 2009, 10:20:18 AM »
WHat is the value of txtbxFileSubject.Text?

I think it is because you are trying to Put full path, but you need to use only file name with extansion in Put method.

Also, you need to open OBEX session before Put.

pesare_ariyayi

  • Guest
Re: problem with sending to multiple devices
« Reply #4 on: May 16, 2009, 10:28:16 AM »
WHat is the value of txtbxFileSubject.Text?

I think it is because you are trying to Put full path, but you need to use only file name with extansion in Put method.
no, txtbxFileSubject.Text is not the path, its just a name that the user writes down. such as "nicePicture"

Also, you need to open OBEX session before Put.
why do i need to do so? i send the file without any problem by opening a connection (wcloppclient.open()) and putting the file in it (for one device at a time) the only problem is that device wont recognize only the extension of the file.
is this problem because of OBEX session? demo uses itself putting without makin any OBEX session.

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: problem with sending to multiple devices
« Reply #5 on: May 16, 2009, 02:02:07 PM »
Quote
no, txtbxFileSubject.Text is not the path, its just a name that the user writes down. such as "nicePicture"
User msut provide extension here.

Quote
why do i need to do so? i send the file without any problem by opening a connection (wcloppclient.open()) and putting the file in it (for one device at a time) the only problem is that device wont recognize only the extension of the file.
is this problem because of OBEX session? demo uses itself putting without makin any OBEX session.

Because it is required before sending the file. And not all device may accept file without opening OBEX session before.

pesare_ariyayi

  • Guest
Re: problem with sending to multiple devices
« Reply #6 on: May 16, 2009, 07:32:08 PM »
thanks for your big favor man! that was all the problem. thank you

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: problem with sending to multiple devices
« Reply #7 on: May 16, 2009, 07:37:46 PM »
You are very welcome.

 

Sitemap 1 2 3 4 5 6 7