Author Topic: Receiving bluetooth with WCL  (Read 32276 times)

Emran

  • Guest
Receiving bluetooth with WCL
« on: January 28, 2013, 11:41:04 AM »
hello
in receiving state, most time we must send 2 time or 3 time to connect and receive with wcl component, also most time connecting time may very long about 2-3min and again send will faild...., i think this problem is for my code, i test this with BluetoothOPPServer sample, and i see this sample is also have this problem, whay?

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: Receiving bluetooth with WCL
« Reply #1 on: January 28, 2013, 12:08:03 PM »
hello,

It may appear because BT stack needs time to initialize/reinitialize. However it would be great to know what BT driver and OS you use.

Emran

  • Guest
Re: Receiving bluetooth with WCL
« Reply #2 on: January 28, 2013, 12:18:42 PM »
my OS is Win7 x64, but i use x86 version of wcl, and how can we find BT driver? if in device manager it is show to item in bluetooth Microsoft Bluetooth Enumerator
and ALPS-UGPZ9-BCM2046

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: Receiving bluetooth with WCL
« Reply #3 on: January 28, 2013, 12:32:52 PM »
It's MS BT driver. If you are trying to connect more than 1 device at the same time to PC you have to use more than 1 instance of wclServer. It looks like you are trying to connect few devices to one instance of WCL server.

Emran

  • Guest
Re: Receiving bluetooth with WCL
« Reply #4 on: January 28, 2013, 01:09:36 PM »
i create 7 instance of wclServer, and not receive, some time receive my be 5% of all sending will receive, i test with single device...

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: Receiving bluetooth with WCL
« Reply #5 on: January 28, 2013, 01:22:22 PM »
The only reason it appears that the BT dongle is busy with other connection. I have just tested OPPServer with cell phones - works as expected. But i'll check it more.

Emran

  • Guest
Re: Receiving bluetooth with WCL
« Reply #6 on: January 28, 2013, 01:38:41 PM »
ok, thank you, i think i have mistake, i have create 7 wclServer and all things work fine, thank you

Emran

  • Guest
Re: Receiving bluetooth with WCL
« Reply #7 on: January 28, 2013, 01:44:48 PM »
how many instance can we create for wclServer, what it's better?

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: Receiving bluetooth with WCL
« Reply #8 on: January 28, 2013, 02:12:23 PM »
wclOPPServer is for OBEX service by default. So yes, it can be a problem if your device doesn't use OBEX or use OBEX in unusual way. wclServer is for any custom RFCOMM based service (or for SPP).

Old BT standard limits it to max 7. New one (since BT 2.0) has no such limit. However, different dongles may have own limitation. Also it somehow limited internaly in MS drivers. By my experience it is usualy about 4-5 max.

Emran

  • Guest
Re: Receiving bluetooth with WCL
« Reply #9 on: January 28, 2013, 02:41:22 PM »
if we create more than instance that dongle not support is it my conflict with other prior instance, for example if i always create 7 instance and some bluetooth device can support 4-5, is all things work fine, or i must create minimum instance of  wclServer to support all device?

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: Receiving bluetooth with WCL
« Reply #10 on: January 28, 2013, 03:02:19 PM »
You will get error message if try to creare more instances than supported. Or (for some stacks) you will not be able to connect.

Emran

  • Guest
Re: Receiving bluetooth with WCL
« Reply #11 on: January 28, 2013, 03:10:40 PM »
then how can i find current dongle how many wclServer instance support?

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: Receiving bluetooth with WCL
« Reply #12 on: January 28, 2013, 03:13:42 PM »
There is no way to know that from application.

Emran

  • Guest
Re: Receiving bluetooth with WCL
« Reply #13 on: February 05, 2013, 07:56:15 AM »
my problem still not solved!
i create 7 instance it work fine but an hour again not work, and hour again work very fine, ....!
when it is not work with WCL, also windows can not receive file, i test this issue problem with 3-4 system that they  have winxp and win7, and with they own bluetooth device.

i change code that can maximum instance create for device, but it is same problem that i say :
Code: [Select]
                        List<wclOPPServer> servers = new List<wclOPPServer>();
                        while (true) {
                            wclOPPServer morc = new wclOPPServer();
                            morc.BluetoothParams.Radio = mainBluetoothRadio;
                            morc.Transport = wclServerTransport.stBluetooth;
                            if (InitGet(morc)) {
                                servers.Add(morc);
                                morCCount++;
                            }
                            else {
                                morc.Dispose();
                                break;
                            }
                        }

Code: [Select]
        public bool InitGet(wclOPPServer wclServer) {

            wclServer.OnListen += (object sender, wclConnectEventArgs e) => {
                ShowErrorIfDebug(e.Error);
            };

            wclServer.OnOBEXProgress += (object sender, wclOBEXProgressEventArgs e) => {
                if (!address_RecevieID.ContainsKey(wclServer.ObjectName)) {
                    address_RecevieID.Add(wclServer.ObjectName, Guid.NewGuid());
                }
                Guid receiveID = address_RecevieID[wclServer.ObjectName];
                var value = (byte)((e.Position * 100) / e.Size);
                if (OnReceivedProgressChanged != null) {
                    OnReceivedProgressChanged(this, receiveID, value, wclServer.Address, wclServer.DeviceName);
                }
            };

            wclServer.OnOBEXObjectReceived += (object sender, wclOBEXObjectReceivedEventArgs e) => {
                if (OnReceivedFile != null) {
                    string filePath;
                    Guid receiveID = address_RecevieID[wclServer.ObjectName];
                    OnReceivedFile(this, receiveID, e.ObjectName, out filePath, wclServer.Address, wclServer.DeviceName);
                    if (!String.IsNullOrEmpty(filePath)) {
                        using (FileStream stream = new FileStream(filePath, FileMode.Create, FileAccess.Write)) {
                            e.Stream.WriteTo(stream);
                        }

                        if (OnFileSaved != null) {
                            OnFileSaved(this, receiveID, e.ObjectName, filePath, wclServer.Address, wclServer.DeviceName);
                        }
                    }
                }
            };

            wclServer.OnConnected += (object sender, EventArgs e) => {
                if (BLL.BlackList.Any(q => q.DevieAddress == wclServer.Address)) {
                    wclServer.Close();
                    wclServer.Listen();
                }
                else {
                    address_RecevieID[wclServer.Address] = Guid.NewGuid();
                }
            };


            int result = wclServer.Listen();
           
            ShowErrorIfDebug(result);
           
            return result == 0;
        }

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: Receiving bluetooth with WCL
« Reply #14 on: February 05, 2013, 08:00:58 AM »
Hello,

If even windows can't accept connection than its something wrong in your system.

However I can;t see in your code how you opens servers (server.listen()).

 

Sitemap 1 2 3 4 5 6 7