Wireless Communication Library Support Forum
Frameworks => Bluetooth Framework => Topic started by: Emran 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?
-
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.
-
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
-
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.
-
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...
-
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.
-
ok, thank you, i think i have mistake, i have create 7 wclServer and all things work fine, thank you
-
how many instance can we create for wclServer, what it's better?
-
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.
-
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?
-
You will get error message if try to creare more instances than supported. Or (for some stacks) you will not be able to connect.
-
then how can i find current dongle how many wclServer instance support?
-
There is no way to know that from application.
-
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 :
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;
}
}
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;
}
-
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()).
-
in code part 2 in last 4 line i call wclServer.Listen();
i know this problem is not in my code or WCL component, it may be with our system, our device, or our device driver.
but why some time i receive fine, very good but some time no! and also i say that i test with 4-5 PC the same issue will occur.
how can i find this problem, why i have this problem in other PCs.
some time if i turn off device and again turn on it work...
some time if i restart PC it will work...
some time if i turn off device and also restart PC it will not work but an hour it will work!!!
i restart "bthserv" service but nothing corrected...
if i can restart bluetooth device in startup my application, my be it work!!?!?! can i restart bluetooth device with WCL?
-
I will check it out today and back to you with my result. May be found some workaround. We have faced such issue long time ago with old dongles but never seen same with modern dongles. Any way, i'll be in touch.
-
thank you
-
Hello,
We did few tests and could reproduce the problem few times with 2 old dongles. We are keep working on this to try to resolve the problem. I'll be in touch.
-
thank you may be it will correct if try resolve problem with old dongle, but i dont think my dongle is old, i dont know?!?! for example my Laptop released date is 2008, and it can 30 wclServer instance and each instance call Listen with out any problem and error, but i will happy if resolve this problem with old dongle.
-
Hello
What happened?
when do you release new version of wcl that corrected with old dongle?
i am waiting, i need it....
-
Hello,
As I alreaqdy told it is not WCL bug but we are looking on possible workaround. If we can we will fix it and I let you know.
-
hello,
may be my problem is this :
my application always discover (discover time 5sec and time between each discover 15 sec) if user device try to connect in discover time (only in 5sec) device connecting is failed!!!
i write blow code on wclServer.OnConnected
if (wclBluetoothDiscovery.Active) {
wclBluetoothDiscovery.Terminate();
}
some time device can connect while in discovering state and OnConnected will occor, but some time device cannot connect faild to connecting...
i dont know, but i think if wclServer have OnConnecting this problem will solve, what do yo think?
thank you.
-
Hello,
Connect operation is exclusive (from both sides) so it is impossible to do any other operations whle connection is established (it is by Bluetooth Specification). So when your dongle discovers devices no one device can connect (and dongle can't connect to other device).